Consulting

Results 1 to 6 of 6

Thread: Sleeper: Change interior color based on a check box

  1. #1
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    Sleeper: Change interior color based on a check box

    I have a check box in C1. How do you check to see if it checked and if so, highlight A1 & B1? Thanks
    Peace of mind is found in some of the strangest places.

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Hi Austen,

    Depends on which kind of checkbox you're using. If it's ActiveX and (you created it from the Toolbox menu), then use this:

    Private Sub CheckBox1_Click()
    If Me.CheckBox1.Value = True Then
        Me.Range("A1:B1").Interior.ColorIndex = 35
    Else
        Me.Range("A1:B1").Interior.ColorIndex = 0
    End If
    End Sub
    If it came from the forms menu, though, you'll have to do something different.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Came from the forms menu. Oh and BTW I want to do it "on Click"
    Peace of mind is found in some of the strangest places.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Quote Originally Posted by austenr
    Came from the forms menu. Oh and BTW I want to do it "on Click"
    Link it to a cell, and then test that cell value.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    example please
    Peace of mind is found in some of the strangest places.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Quote Originally Posted by austenr
    example please
    =IF(A20,"Checked","Unchhecked")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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