Combining names

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

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
 
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
 
Back
Top