Macro to Refresh Pivot Table

lprabhu1107

Board Regular
Joined
Mar 10, 2011
Messages
106
Hi,

I have created Pivot Table with Date in the Pagefield and other data in the Row, Column and Data Fields.

In Pagefield i can change date by using the dropdown menu, whenthedate changes all the data in relevant fileds changes


I want to create a macro to change the date to todays date and refresh the pivot table.

can u pls suggest ways to do this

Regards

Prabhu
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
try this to refresh pivot table:
[FONT=&quot]Private[/FONT][FONT=&quot] Sub Worksheet_Activate() [/FONT]
[FONT=&quot] 'If this worksheet is activated, refresh the pivot table[/FONT]
[FONT=&quot] Sheets("Pivot").PivotTables("PivotTable1").RefreshTable
[/FONT]
[FONT=&quot]End Sub[/FONT]


[FONT=&quot][/FONT]
 
Upvote 0
This code works for refreshng pivot table...is there any ways to change thedate in the pagefield and then refresh the pivot table
 
Upvote 0
Hey, I have that right now!!!

I added a submit button, then used a macro code to it. I found it somewhere online and it's awesome!

link removed per OP request

Sub BUTTONNAME_Click()
Sheets("SHEETNAME").Select
ActiveSheet.PivotTables("NAMEOFPIVOTTABLE").RefreshTable
End Sub

------
I have this for my project:
Sub Button2_Click()
Sheets("dashboard").Select
ActiveSheet.PivotTables("PivotTable2").RefreshTable
End Sub
 
Last edited by a moderator:
Upvote 0
When you save, remove ".zip" from the end and type in xlsm instead (and select save as all files instead of save as zip file). It's not a zip file.
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

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