Hi
I am generating a pivot table out of worksheet named: Reporting
I recorded an excel macro of the steps to produce the pivot table:Because the range of cells changes I have produced theses variables:VB Code:
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _ "Reporting!R1C1:R378C31" ActiveSheet.PivotTables("PivotTable3").SmallGrid = False ActiveSheet.PivotTables("PivotTable3").AddFields RowFields:=Array("Severity", _ "Open/Closed"), ColumnFields:="Area"
LastRow
LastCol
I am trying to use those in the code above such that:When in this format the code doesn't work.VB Code:
LastRow = ":R" & LastRow ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:=“Reporting!R1C2” & LastRow + “C” + LastCol ActiveSheet.PivotTables("PivotTable3").SmallGrid = False ActiveSheet.PivotTables("PivotTable3").AddFields RowFields:=Array("Severity", _ "Open/Closed"), ColumnFields:="Area"
Cheers
Dave




Reply With Quote