Dim targetSheet As Worksheet
Dim rowIndex, columnCount As Integer
Set targetSheet = ActiveSheet
columnCount = UBound(initialRange, 2)
For rowIndex = 3 To 304
Set targetSheet = Sheets.Add(After:=targetSheet)
' The (Row #) is added to sheet name to prevent Workbook from having duplicated name sheets
' Remove if not applicable
targetSheet.Name = Cells(rowIndex, "A").Value & " (Row " & rowIndex & ")"
Cells(rowIndex, "A").Resize(1, 7).Copy
targetSheet.Cells(columnCount, "A").End(xlUp).PasteSpecial Transpose:=True
Application.CutCopyMode = False
Next rowIndex
1 回答
这是您需要的代码:
唯一的问题是Excel可能会耗尽超过300个WorkSheets的资源 .