Hi,
I have a problem with the function that creates the pivot table, I wanted to select two filters "CRD_RWG" and "NEW_DEFAULT" and two items as values that will be the sum.
Here I got error invalid or unqualifed reference:
How to resolve it ?
This is my code :
cross post : VBA Problem with invalid or unqualifed reference in pivot table
I have a problem with the function that creates the pivot table, I wanted to select two filters "CRD_RWG" and "NEW_DEFAULT" and two items as values that will be the sum.
Here I got error invalid or unqualifed reference:
Rich (BB code):
End With
.AddDataField .PivotFields
How to resolve it ?
This is my code :
Rich (BB code):
' tabel przestawna w kredytach dla nowych defaultow '
Set sh1 = wbMe.Sheets("kredyty")
lr = sh1.Range("A" & Rows.Count).End(3).Row
ptver = 6
tbName = "Tabela przestawna"
Sheets.Add after:=Sheets(Sheets.Count)
Set sh2 = ActiveSheet
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=sh1.Name & "!R1C4:R" & lr & "C12", Version:=ptver).CreatePivotTable _
TableDestination:=sh2.Name & "!R2C1", TableName:=tbName, _
DefaultVersion:=ptver
With sh2.PivotTables(tbName)
.PivotFields ("CRD_RWG")
.PivotFields ("NEW_DEFAULT")
.Orientation = xlRowField
.Position = 1
End With
.AddDataField .PivotFields("Suma z CRD_EKSP_PIER_DC_FIN"), "Sum", xlSum
.AddDataField .PivotFields("Suma z CRD_KOR_DC_FIN"), "Sum", xlSum
End With
cross post : VBA Problem with invalid or unqualifed reference in pivot table
Last edited by a moderator: