When I record the creation of a pivot table, and choose for my data source columns A:D, the code recorded for the column selection is similar to this, showing C for columns 1-4:
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"'Summary View'!C1:C4"
I then put that same code back into my macro, looking like this:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'Summary View'!C1:C4").CreatePivotTable TableDestination:= _
"'[Regional CPS (Put in Date) Filled Compared to Target-Full.xls]Summary View'!R1C16" _
, TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
However, when I run my macro, instead of the source being Columns 1-4, the source is column c, rows 1-4. How do I tell my macro I want columns 1-4?
Bookmarks