View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default Loading UserForm Controls (with a twist!)

If the checkbox names correspond EXACTLY to what you put in the cells
(as you describe, CheckBox1 corresponds to "Caption 1"), then you
could do something like this:

1) Split the value of the cell into a Variant:

Dim values() As Variant
values = Split(Range("A1").Value, ";")

2) Loop through the variant and re-populate each control accordingly

Dim i As Long
Dim valueName As String
Dim controlNumber As Long
For i = LBound(values) to UBound(values)
valueName = values(i) ' C

' extract number so we know which control to activate
' i.e. for "Caption 1", controlNumber = 1
controlNumber = Right$(valueName,1)

' re-populate the control
Me.Controls("CheckBox" & controlNumber).Value = -1
Next i

--JP


On Oct 30, 11:21*am, Trevor Williams
wrote:
Hi All,

I have a UserForm that contains a multipage control. *Each page of the
control contains several Frames, and each Frame contains several CheckBoxes.

Once the user has made their selection the Captions of the Checkboxes are
written to a specific Cell on the ActiveSheet, seperated with a semi-colon.