VBA Pivot Table to Change and Look at Data Source based on Cell Value

TTUK

Board Regular
Joined
Apr 5, 2012
Messages
137
Hi,

I really need some help in creating a macro whereby a Pivot Table's source is automatically changed and updated based on a cell value....


I have a Pivot Table which is in a Workbook Sheet Name of 'Stock VLookup' and in Cell D5 I have the Pivot Table.

I want this Pivot Table to pull through its source location which on our server is
S:\05 Supply Chain\PD\

The file name: Hourly stock 140316.xls

So the complete file path for the spreadsheet to lookup is: S:\05 Supply Chain\PD\140316.xls



So effectively in Cell D4 on the Stock Vlookup tab, id like the user to be able to type in the file name of 140316.xls and the data pull through in the Pivot Table.


Another way of me trying to explain this is:

1. Sheet Name Stock VLookup Has Pivot Table located in cell D5
2. In cell D4 is the filename of the file i need the pivot table to source to change too
3. Pivot Table to change is source in the filepath location of S:\05 Supply Chain\PD\ to lookup the file name is D4
4. Data in the Pivot Table is updated.


I do hope this makes sense and someone much clever than me can help me out with this?!

I look forward to your support! :)
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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