ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combining names (https://www.excelbanter.com/excel-programming/286276-combining-names.html)

Thomas[_9_]

Combining names
 
I have 8 checkboxes and a variable BoxNo with a number
from 1-8.

I want to be able to make the statement:

If CheckBox6 = True

but by using the variable to determine the name of the
checkbox.

Something like 'If CheckBox & BoxNo = True
but something that actually works

Thanks for the help,
Thomas

Rob van Gelder[_4_]

Combining names
 
Private Sub CommandButton1_Click()
Dim i As Integer

i = 1
If Controls("CheckBox" & i).Value = True Then
MsgBox "checked"
Else
MsgBox "unchecked"
End If
End Sub

"Thomas" wrote in message
...
I have 8 checkboxes and a variable BoxNo with a number
from 1-8.

I want to be able to make the statement:

If CheckBox6 = True

but by using the variable to determine the name of the
checkbox.

Something like 'If CheckBox & BoxNo = True
but something that actually works

Thanks for the help,
Thomas





All times are GMT +1. The time now is 10:36 AM.

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