ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   question regaridng checkboxes (https://www.excelbanter.com/excel-programming/385205-question-regaridng-checkboxes.html)

Monte0682

question regaridng checkboxes
 
I have 10 checkboxes on my worksheet. I wrote this code:

Public Function Check_box(i)
If Sheet1.CheckBox1.Value = True Then
Range("B3:G3").Interior.Color = RGB(135, 206, 235)
Range("G3").Value = "YES"
Range("G3").HorizontalAlignment = xlCenter
Else
Range("B3:G3").Interior.ColorIndex = xlNone
Range("G3").Value = ""
End If

End Function

How can I modify this so I can use it for all checkboxes... I know on
the forms you can use something:

controls("Checkbox"&i).value...etc where i is the checkbox number


[email protected]

question regaridng checkboxes
 
I put just for 3 of them.You can put 10 of course.


If Me.CheckBox1 Or Me.CheckBox2 Or Me.CheckBox3 Then
Range("B3:G3").Interior.Color = RGB(135, 206, 235)
Range("G3").Value = "YES"
Range("G3").HorizontalAlignment = xlCenter
Else
Range("B3:G3").Interior.ColorIndex = xlNone
Range("G3").Value = ""
End If



All times are GMT +1. The time now is 05:34 PM.

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