Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Attaching macro to a pivot table drop down
Hi - I'm wondering if I can attach a macro to one of the
drop down fields in my pivot table. IE - when I choose "Yes" from one of my drop down fields in my pivot table, I want to attach a macro to this action...any help is appreciated! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Attaching macro to a pivot table drop down
To run a macro when the page field is changed, use code similar to the
following, where the page field is named "Region" -- '======================================== Dim mvPivotPageValue As Variant Private Sub Worksheet_Calculate() 'variation on code by Robert Rosenberg 2000/01/11 ''I use a module level variable (see above) to keep track of ''the last selection from the Page Field. ''This routine was place in the Worksheet ''containing the PivotTable's code module. Dim pvt As PivotTable Set pvt = ActiveSheet.PivotTables(1) If LCase(pvt.PivotFields("Region").CurrentPage) _ < LCase(mvPivotPageValue) Then Application.EnableEvents = False mvPivotPageValue = _ pvt.PivotFields("Region").CurrentPage 'your macro name here Application.EnableEvents = True End If End Sub '============================================== Rob wrote: Hi - I'm wondering if I can attach a macro to one of the drop down fields in my pivot table. IE - when I choose "Yes" from one of my drop down fields in my pivot table, I want to attach a macro to this action...any help is appreciated! -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot Table drop down | Excel Discussion (Misc queries) | |||
Pivot Table Drop down | Charts and Charting in Excel | |||
Attaching a 2 item list to a cell / drop-down? | Excel Discussion (Misc queries) | |||
Sorting pivot table drop-down | Excel Discussion (Misc queries) | |||
Attaching drop down to macro | Excel Programming |