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
 

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

Back
Top