checkbox and macros

T

Tdebb8594

I am trying to make a checkbox work as an on off switch. I would like it to
change the background color of a group of cells. Is this possible?
 
R

Ron de Bruin

Hi Tdebb8594

If you use a checkbox from the control toolbox you can use this code in the
Click event

Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Range("A1:A10").Interior.Color = vbRed
Else
Range("A1:A10").Interior.Color = xlAutomatic
End If
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