Pivot Chart VBA question

joeshu26

Board Regular
Joined
Oct 30, 2013
Messages
136
Hi,

I have recorded the following macro to change a chart style. I would like to add some conditionality to the macro so that if the chart style equals ChartStyle = 27 then the macro changes the chart to ChartStyle = 26. And if the chart was already style 26 then it would change to chart style 27.

Sub Chartchange()

ActiveSheet.ChartObjects("Chart 13").Activate
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 27

End Sub

Any help is appreciated, thanks!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,196,414
Messages
6,015,127
Members
441,874
Latest member
saustark

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