我需要找到一个脚本,允许我使用工作簿中索引表的信息。
提前谢谢
答案 0 :(得分:0)
以下是您需要的代码:
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
唯一的问题是Excel可能会耗尽超过300个WorkSheets的资源。