Pivot Table Query VBA

AustinB1980

New Member
Joined
Feb 18, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi

I need a bit of help stumped getting this to work. I want to refresh specific pivot tables and know the name and the range of each table but I don’t want to use the name in the query I want to use a reference to the name which had been generated by another process. Think example might help clarify what I am trying to do

Sub A()
Set A = Worksheets(“a”).cells(1,14)
Worksheets(“b”).activate
Active sheet.PivotTables(A).PivotCatche.Refresh
End Sub

this returns run time error 1004

the query for A returns “PivotTable1” which is coming from a vlookup elsewhere in the workbook and I can see that name is being used in the formula

If I substitute A for PivotTable1 then it works fine but I need to link the refresh to names of pivot tables generated by another process
Any advice is much appreciated
Thanks
Austin
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top