+ Reply to Thread
Results 1 to 8 of 8

Change Chart Axis Font Color with a Checkbox

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Change Chart Axis Font Color with a Checkbox

    Hi Jason

    Sorry my bad, I didn't realize that you used a Form formant not Activex formant.

    So, now try this:

    Right click on your checkbox, choose "assign macro", then if you have something like Checkbox5_Click on the list select it, choose Edit and then paste this code:

    ActiveSheet.ChartObjects("Chart5").Activate
    
    With ActiveChart.Axes(xlValue).TickLabels.Font
        If .Color = RGB(166, 166, 166) Then
            .Color = RGB(0, 0, 0)
        Else
            .Color = RGB(166, 166, 166)
        End If
    End With
        
       ActiveSheet.Range("A1").Select  'to deactivate chart

    Hope this help you.

  2. #2
    Registered User
    Join Date
    08-20-2014
    Location
    Kelowna, Canada
    MS-Off Ver
    2010
    Posts
    10

    Re: Change Chart Axis Font Color with a Checkbox

    Would it be more efficient to switch the check boxes to ActiveX?

  3. #3
    Registered User
    Join Date
    08-20-2014
    Location
    Kelowna, Canada
    MS-Off Ver
    2010
    Posts
    10

    Re: Change Chart Axis Font Color with a Checkbox

    Quote Originally Posted by Sbarro79 View Post
    Hi Jason

    Sorry my bad, I didn't realize that you used a Form formant not Activex formant.

    So, now try this:

    Right click on your checkbox, choose "assign macro", then if you have something like Checkbox5_Click on the list select it, choose Edit and then paste this code:

    ActiveSheet.ChartObjects("Chart5").Activate
    
    With ActiveChart.Axes(xlValue).TickLabels.Font
        If .Color = RGB(166, 166, 166) Then
            .Color = RGB(0, 0, 0)
        Else
            .Color = RGB(166, 166, 166)
        End If
    End With
        
       ActiveSheet.Range("A1").Select  'to deactivate chart

    Hope this help you.
    Thanks, I got that to work but have now run into a new problem. I also have an "All" checkbox, that when clicked either makes all other checkboxes true or false. If I use that then the font color on the chart doesn't change. I could add a similar macro to that checkbox but then it is only changing the font color based on what it is and not on whether or not the checkbox beside it is true or false. I think I might try switching the checkboxes to ActiveX and trying your other suggested code and see if that solves it.


    EDIT: got the ActiveX checkboxes inserted but ran into a couple of aesthetics issues that I can't figure out. First one, if a checkbox does not have a caption it looks kind of blurred..can that be changed? Second, when there is a caption when the checkbox is clicked the caption looks like it is selected (dashed box goes around the caption), how do I make it so that does not happen?
    Last edited by JasonBoyd; 08-26-2014 at 12:14 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to change axis font size for a bar chart
    By excelnoob61 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2014, 03:15 PM
  2. [SOLVED] How to change the Font Properties of Chart Primary/Secondary X-Y Axis Title using VBA ?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-09-2013, 09:49 AM
  3. Replies: 2
    Last Post: 02-04-2013, 02:00 PM
  4. Infuriating VB Excel chart issue - how to change y axis font color
    By Ace of Clubs in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-07-2009, 01:22 AM
  5. [SOLVED] change font color of first cell in data table attached to chart
    By momo in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-18-2005, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1