Unclick Code on Check box command button

T

Todd

I have code written that when the control check box is
selected certain cells will highligh. I would like for
those same cells to turn white when the check box is
unchecked. What code do I need? Thanks!

Private Sub CheckBox1_Click()
Range("B17:D17").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.Value = 0


End With
End Sub
 
D

Dave Peterson

How about checking if the checkbox is checked or not checked <vbg>?

Option Explicit
Private Sub CheckBox1_Click()
With Me.Range("B17:D17").Interior
If Me.CheckBox1.Value = True Then
.ColorIndex = 6
.Pattern = xlSolid
Else
.ColorIndex = xlNone
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top