View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default CheckBoxes on MultiPage

Bob,

No, I hadn't tried that.
Your suggestion didn't work until I removed the UserForm1 reference but
you did get me started in the right direction.

The following:
MultiPage1.Pages(0).Controls("CheckBox" & x).Value = True
Did work though.

There were actually 25 CheckBoxes across the 3 pages on that MultiPage
so my final code ended up looking like this:

Private Sub Binary2CB()
cbResult = "0100000000001110000000010" ' (For test purposes)
Dim x As Integer
For x = 1 To 25
If Mid(cbResult, x, 1) = 1 Then
If x < 12 Then
MultiPage1.Pages(0).Controls("CheckBox" & x).Value = True
Else
If x 21 Then
MultiPage1.Pages(2).Controls("CheckBox" & x).Value =
True
Else
MultiPage1.Pages(1).Controls("CheckBox" & x).Value =
True
End If
End If
End If
Next x
End Sub

Thank you very much for your help,
John



"Bob Phillips" wrote in message
...
Have you tried

Userform1.MultiPage1.Pages(0).Controls("CheckBox" & x).Value = True

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Wilson" wrote in message
...
Initially I was setting the values of a group of CheckBoxes on a UserForm
via the following code (and it worked well):

Private Sub Binary2CB()
cbResult = "0011001101" ' (for test purposes)
Dim x As Integer
For x = 1 To 10
If Mid(cbResult, x, 1) = 1 Then
Userform1.Controls("CheckBox" & x).Value = True
End If
Next x
End Sub

I've since moved the CheckBoxes onto a Mulitpage control
on the same UserForm.
How can I modify the code above to make this work?
(I've tried a number of different manipulations but can't seem to find
the
right combination).

Thanks,
John