![]() |
How do you build pivot table in VB
I saved a macro that builds a given pivot table in excel and is shown below. Question is how do I change this so that the "SourceData" range can be given in row number, column number format rather than what's shown
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= "Sheet1!R1C1:R29C20").CreatePivotTable TableDestination:="", TableName:= "PivotTable1 ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1 ActiveSheet.Cells(3, 1).Selec With ActiveSheet.PivotTables("PivotTable1" .ColumnGrand = Fals .RowGrand = Fals .SmallGrid = Fals End Wit ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:=Array("WMW", "WML" , "COIL HGT"), ColumnFields:="Run# ActiveSheet.PivotTables("PivotTable1").PivotFields ("Qty").Orientation = xlDataFiel Range("B7").Selec Selection.Delet Range("A7").Selec Selection.Delet |
All times are GMT +1. The time now is 12:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com