Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calling a macro on a change of Field Button in Pivot Chart


Can anyone tell me how to initiate the following procedures when a user
changes a field buttong in a pivot chart? The following are macros in a
module that I need to run if "Under 50 Stores", "50 to 200 Stores", or
"Over 200 Stores" is selected from the field button of the chart:

-------------------------------------------------

Sub Format_Under_50_Stores()

ActiveChart.PivotLayout.PivotTable.PivotFields("Ra nge").CurrentPage
= _
"Under 50 Stores"
ActiveChart.SeriesCollection("Under 50 Stores").Select
With Selection.Border
..ColorIndex = 1
..Weight = xlThick
..LineStyle = xlContinuous
End With
With Selection
..MarkerBackgroundColorIndex = xlNone
..MarkerForegroundColorIndex = xlNone
..MarkerStyle = xlNone
..Smooth = True
..MarkerSize = 5
..Shadow = False
End With
ActiveChart.Deselect
End Sub

Sub Format_50_to_200_Stores()

ActiveChart.PivotLayout.PivotTable.PivotFields("Ra nge").CurrentPage
= _
"50 to 200 Stores"
ActiveChart.SeriesCollection("50 to 200 Stores").Select
With Selection.Border
..ColorIndex = 1
..Weight = xlThick
..LineStyle = xlContinuous
End With
With Selection
..MarkerBackgroundColorIndex = xlNone
..MarkerForegroundColorIndex = xlNone
..MarkerStyle = xlNone
..Smooth = True
..MarkerSize = 5
..Shadow = False
End With
ActiveChart.Deselect
End Sub

Sub Format_Over_200_Stores()

ActiveChart.PivotLayout.PivotTable.PivotFields("Ra nge").CurrentPage
= _
"Over 200 Stores"
ActiveChart.SeriesCollection("Over 200 Stores").Select
With Selection.Border
..ColorIndex = 1
..Weight = xlThick
..LineStyle = xlContinuous
End With
With Selection
..MarkerBackgroundColorIndex = xlNone
..MarkerForegroundColorIndex = xlNone
..MarkerStyle = xlNone
..Smooth = True
..MarkerSize = 5
..Shadow = False
End With
ActiveChart.Deselect
End Sub


--
tobriant
------------------------------------------------------------------------
tobriant's Profile: http://www.excelforum.com/member.php...o&userid=25155
View this thread: http://www.excelforum.com/showthread...hreadid=481913

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change/set pivot table autofilter criteria with macro button jackie Excel Discussion (Misc queries) 3 March 16th 09 02:03 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
Unable to change field settings in calculated field in a pivot tab Mike Excel Discussion (Misc queries) 0 September 25th 06 07:45 PM
Q: Hiding a field button on a pivot chart Kompu Kid Excel Discussion (Misc queries) 2 October 4th 05 12:43 AM
Create event triggered by Pivot Chart field button Mike Collard Excel Programming 0 January 28th 04 12:00 PM


All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"