Nope - you need to include headers for the pivot table to use as field names. So:
Dim LR1 As Long
Dim PT As PivotTable
LR1 = Range("A" & Rows.Count).End(xlUp).Row - 1
Set PT = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Report1!R1C1:R" & LR1 & "C17").CreatePivotTable(TableDestination:=Sheets.Add.Cells(1, 3), _
DefaultVersion:=xlPivotTableVersion10)
With PT
.AddFields RowFields:=Array("Imprint", "DAC Market", "Data")
With .PivotFields("Net Val")
.Orientation = xlDataField
.Position = 1
End With
With .PivotFields("Margin")
.Orientation = xlDataField
.Position = 2
End With
With .PivotFields("Home Return")
.Orientation = xlDataField
.Caption = "Sum of Home Return"
.Function = xlSum
End With
With .DataPivotField
.Orientation = xlColumnField
.Position = 1
End With
End With
Note I changed the C18 to C17 since you said column Q, not R.
Bookmarks