Error in creating pivot table with vba macro

Hello friends, I am creating an automation where from a file, rows are filtered and many new files are created, one for each category.

In each of these new files I need to create a pivot table. I used the invoke macro activity, but it generates an error when it is executed.

I am attaching screenshots of the error, of the table I need and the macro txt, to see if you can help me. I’ve been researching the error, but couldn’t find a solution.



Macro_tabla_dinamica.txt (878 Bytes)

Tahnks!!!

Hi @carlos_sabino ,

From the code I see that you created a pivotcache, but did not insert it into sheet. please include a insert command after line :Cells(3, 1).Select as below

PCache.CreatePivotTable _
(TableDestination:=Worksheets(“”).Cells(1, 1), TableName:=“TablaDinámica5”)

cheers