Hi all,
Been searching the forums and the internet for a way to change the font color of a chart axis when a checkbox is set to true. I haven't been successful yet so that is why I am posting.
let checkbox be checkbox5 and chart be chart5. What I would like to happen is that if checkbox5 is true then the font color of the horizontal axis changed to grey (RGB 166,166,166), if it is false then I would like the font color of the horizontal axis to be black (RGB 0,0,0). I also would like this macro to be run every time the checkbox changes, or the corresponding cell changes to TRUE or FALSE (it is in another sheet, say sheet2). I am not sure what I am missing but it might be something silly. This is the code I have so far but all it is doing is showing the chart as selected and not changing the font color. I would also like it to not physically select the chart, this is for a dashboard so the selecting of the chart throws off some of the visuals a bit, but not sure how to do change the chart values without selecting it.
Sub ChartChangeFSPS()
On Error Resume Next
If ActiveSheet.Checkbox5.Value = True Then
ActiveSheet.ChartObjects("Chart5").Activate
ActiveChart.Axes(xlValue).Select
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(166, 166, 166)
.Transparency = 0
.Solid
End With
ElseIf ActiveSheet.Checkbox5.Value = False Then
ActiveSheet.ChartObjects("Chart5").Activate
ActiveChart.Axes(xlValue).Select
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Solid
End With
End If
End Sub
Bookmarks