ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   checkbox and macros (https://www.excelbanter.com/excel-worksheet-functions/9252-checkbox-macros.html)

Tdebb8594

checkbox and macros
 
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?

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




--
Regards Ron de Bruin
http://www.rondebruin.nl



"Tdebb8594" wrote in message ...
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?





All times are GMT +1. The time now is 04:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com