2012-03-28 92 views
-1

我需要找到一個腳本,允許我使用工作簿中索引表中的信息。Excel工作表單元格到不同工作表

  • 我需要它從範圍A3:G304獲取數據。
  • 數據將分散到各自的工作表中。
  • 這些圖紙是針對列A中的值命名的,需要將其放置在單元格中,如下面的A到A1; B到A2; C到A3; D到B3; E至C3; F到E2; G到G2。
  • 每一行對應一張不同的紙張。

預先感謝您

+0

您是否嘗試過「細胞」和「間接」? – RobinGower 2012-03-28 16:06:20

回答

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個工作表用完ressources的。

相關問題