SOLVED

pivot table macro error

Copper Contributor

Hi,

Whats is wrong with the "end of statement"? 

 

pivot table macro errorpivot table macro error

8 Replies

Does it help if you use

        :="'" & pivotWS & "'!R3C1", ...

@Hans Vogelaar 

 

hi. have got this new error

 

pivot table macro error3.PNG

 

 

@annapet1973 

What is the error message?

It might help if you attached a copy of the workbook, or uploaded it to a cloud service such as OneDrive, google Drive or Dropbox, obtained a link to the uploaded file and posted that link in a reply.

@annapet1973 

When I click that link, I get "You need access"...

best response confirmed by annapet1973 (Copper Contributor)
Solution

@annapet1973 

Thanks, that worked. Use

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "'08.04.2022'!R1C1:R19C9", Version:=6).CreatePivotTable TableDestination:= _
        pivotWB & "!R3C1", TableName:="PivotTable1", DefaultVersion:=6
Thanks!!! It works now
1 best response

Accepted Solutions
best response confirmed by annapet1973 (Copper Contributor)
Solution

@annapet1973 

Thanks, that worked. Use

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "'08.04.2022'!R1C1:R19C9", Version:=6).CreatePivotTable TableDestination:= _
        pivotWB & "!R3C1", TableName:="PivotTable1", DefaultVersion:=6

View solution in original post