Big Bruiser
New Member
- Joined
- Dec 15, 2010
- Messages
- 28
I would like to create a macro that looks at my entire workbook and changes the formats for each chart. The workbook has several tabs with graphs in each tab so it would be helpful to change them all with a press of a button.
Here's what I have started
I would like to add the following:
if charttype = xlpie then
data label format = percentage
font = arial bold size 10
if chartype = clustered bar then
Series #1 fill should be RGB (78, 38, 131)
Series #2 fill should be RGB (207, 111, 25)
vertical gridlines = true
axes labels should be arial size 14
if charttype = clustered column then
horizontal gridlines = true
axes labels should be arial size 8
interval between labels = automatic
Thanks for your help!! Let me know if I can help in any way. I used an old macro and was able to add some of the formatting by looking at a recorded macro, but I got errors if I tried adding any of the above. Thanks!
Here's what I have started
Code:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim ch As ChartObject
Dim ax As Axis
For Each ws In ActiveWorkbook.Worksheets
For Each ch In ws.ChartObjects
With ch.Chart
.HasTitle = False
If .ChartType = xlPie Then .SetElement (msoElementDataLabelInsideEnd)
.PlotArea.Format.Fill.ForeColor.RGB = RGB(255, 255, 255)
.ChartArea.Format.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With
Next ch
Next ws
End Sub
I would like to add the following:
if charttype = xlpie then
data label format = percentage
font = arial bold size 10
if chartype = clustered bar then
Series #1 fill should be RGB (78, 38, 131)
Series #2 fill should be RGB (207, 111, 25)
vertical gridlines = true
axes labels should be arial size 14
if charttype = clustered column then
horizontal gridlines = true
axes labels should be arial size 8
interval between labels = automatic
Thanks for your help!! Let me know if I can help in any way. I used an old macro and was able to add some of the formatting by looking at a recorded macro, but I got errors if I tried adding any of the above. Thanks!