0
と、自分の新しいワークシート上の各私はコードUが新しいピボットで新しいタブを作成し、列の各行にダイナミック名ここではVBA
をやりたいです、ループ内でピボットテーブルを作成しますテーブルは、マスターワークシートのデータに基づいて
私は信じているダイナミックテーブルの宛先です。私は "Master"ワークシートのリストに基づいた変数PayorNameを作成しています。ピボットテーブル上に "[会社]ピボット"という名前のシートが必要です
私は一度にあまりにも多くをやろうとしていますか?
部分コード:
Dim LastRowA As Long
With ActiveSheet
LastRowA = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Dim LastRowU As Long
With ActiveSheet
LastRowU = .Cells(.Rows.Count, "U").End(xlUp).Row
End With
ActiveSheet.Name = "Master"
'this loop is set to run the first 5 items temporarily
'later it will go to lastrowU
For i = 2 To 5
PayorName = Sheets("Master").Cells(i, "U").Value
Sheets.Add
ActiveSheet.Name = PayorName & " Pivot"
With ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Master1!R1C1:R" & LastRowA)
.CreatePivotTable TableDestination:=Sheets(PayorName & " Pivot").Range("A3"), TableName:="PivotTable"
End With
Sheets(PayorName & " Pivot").Select
Cells(3, 1).Select
' from here I set the pivot's fields
next i