Color cell if checked

oxicottin

Board Regular
Joined
Feb 21, 2007
Messages
126
I have a cell M24 that I would like to color yellow if a check box (chkFivePoints) is true. How can I do this? Thanks....
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I have a cell M24 that I would like to color yellow if a check box (chkFivePoints) is true. How can I do this? Thanks....
Where is the checkbox located at... on a UserForm or directly on the worksheet?

If on the worksheet, what type of checkbox is it... Forms or ActiveX?
 
Upvote 0
Try this:
Assuming several things
Code:
Private Sub chkFivePoints_Click()
'Modified  7/23/2018  12:21:48 PM  EDT
    If chkFivePoints.Value = True Then
        Range("M24").Interior.Color = vbYellow
        Else
            Range("M24").Interior.Color = xlNone
    End If
End Sub
 
Upvote 0

That worked great thank you....


Rick, The Checkbox was an active X.... I just placed it next to a merged cell. Thanks!
 
Upvote 0
Rick, The Checkbox was an active X.... I just placed it next to a merged cell. Thanks!

Try using this for the checkbox's Click event (if you are typing this instead of copy/pasting, be sure to note the minus sign in front of the number 6)...
Code:
Private Sub chkFivePoints_Click()
  Range("M24").Interior.ColorIndex = -6 * chkFivePoints.Value
End Sub
 
Last edited:
Upvote 0
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
That worked great thank you....


Rick, The Checkbox was an active X.... I just placed it next to a merged cell. Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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