Formatting Transparency of Axes in VBA

jjjjjjj

New Member
Joined
Oct 7, 2013
Messages
1
I'm sure this isn't news here, but Excel 2007's Record Macro function doesn't play nice with formatting charts.

What I need to do is adjust the transparency for my (xlCategory, xlSecondary) and (xlValue, xlPrimary) axes. I've tried many different options for <!--?--><!--?-->"?" within ActiveChart.Axes(xlCategory, xlSecondary)."?"<!--?-->.Transparency = 0.75 and ActiveChart.Axes(xlValue, xlPrimary)."?"<!--?-->.Transparency = 0.75 from extensive research, but they all seem to either be invalid or have no effect. I've been unable to find out how to implement VBA code that achieves the following functions from within Excel:

Chart Tools > Layout > Axes > Secondary Vertical Axis > More Secondary Vertical Axis Options > Line Color > Solid Line > Transparency > 75%
Chart Tools > Layout > Gridlines > Primary Horizontal Gridlines > More Primary Horizontal Gridlines Options > Line Color > Solid Line > Transparency > 75%

My VBA code for manipulating my chart seems to go back to the "Automatic" setting for Line Color within the Format options. Does this need to be set to "Solid line" somehow before setting the transparency?

I might also need to change the color of these axes once this problem is solved...

Thank you very much for your help. It's very much appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi

This is an example for the Y axis:

Code:
Sub test()
Dim cht As Chart
Dim YAxis As Axis

Set cht = ActiveChart
Set YAxis = cht.Axes(xlValue)

With YAxis.Format.Line
    .Visible = msoTrue
    .ForeColor.RGB = vbBlue
    .Transparency = 0.75
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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