Weird problem for changing axis color

mikejvir

Board Regular
Joined
Jan 3, 2008
Messages
95
Hello All,

I want to change the font color on my axis's
xLCatergory
xLValue, xLPrimary
xLValue, xLSecondary

VBA threw an error. So I did a macro record and got this.

Sub Macro7()
'
' Macro7 Macro
'
ActiveChart.Axes(xlValue, xlSecondary).Select
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 255)
.Transparency = 0
.Solid
End With
End Sub
VBA Code:
Sub Macro7()
'
' Macro7 Macro
'
    ActiveChart.Axes(xlValue, xlSecondary).Select
    With Selection.Format.TextFrame2.TextRange.Font.Fill
      .Visible = msoTrue
      .ForeColor.RGB = RGB(0, 0, 255)
      .Transparency = 0
      .Solid
    End With
End Sub

I copied this to my other code and still get an error which is
VBA Error.png


No sure what to do since this macro was recorded and did what I want. When I rerun it will not.

Thanks in advance.

Mike Virostko
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Did you select the chart before running the macro? I don't know which line it was highlighting when the error came up.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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