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! |
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 |
All times are GMT +1. The time now is 02:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com