How To Fire Macro after -----

Perrister

Board Regular
Joined
Nov 30, 2004
Messages
88
I have set up a slicer that controls 2 different pivot tables attached to the same data, very simple basically synchronizes the tables based on user selection.

After the selection I would like the to fire a macro that re-sizes columns to data for best fit. if I turn on auto-size columns within pivot tables columns are too wide, if I select ALL CELLS then auto fit looks beautiful but I would like for this to happen automatically after user selection.

I have assigned macro to Slicer but then lose slicer functionality, basically fires macro every time you touch slicer, unless you right click, then you can use slicer, but macro does not fire.

I am using Excel 2010.

The desired is for user to select quarter for view, then pivots synch to user selection, then columns auto fit for neatness.

Thanks,
Perry
 
Last edited:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Have the macro fire on pivottable update instead.

Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    'Code
End sub

It would have to be in the worksheet of the pivottable, but I believe it'd accomplish what you want.
 
Last edited:
Upvote 0
Have the macro fire on pivottable update instead.

Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    'Code
End sub

It would have to be in the worksheet of the pivottable, but I believe it'd accomplish what you want.

thank you
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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