Hi,
What I need to do is set a variable equal to all the ComboBoxes in a user form. I'm sure there is an easy code line for this, I just don't know what it is. Here is the code which inserts the comboboxes:
This all occurs with a large while loop. Thus each pass by this it will create a new combobox. I also adjust the PosL after each box, so they aren't on top of each other. It also uses some Public Variables.
The reason I'm trying to set a variable equal to all the comboboxes in the form is because I have no idea how many will be created. My ultimate goal is to simply change the ".locked = true" to ".locked = false". The user will select an "edit" button which then unlocks the boxes for editing.
Anybody know what code I should use?
What I need to do is set a variable equal to all the ComboBoxes in a user form. I'm sure there is an easy code line for this, I just don't know what it is. Here is the code which inserts the comboboxes:
Code:
Set cNewComboBox = .Controls.Add("Forms.ComboBox.1")
With cNewComboBox
quickcount = counter
While Worksheets(2).Cells(quickcount, TempCount + 1).Value <> ""
cNewComboBox.AddItem Worksheets(2).Cells(quickcount, TempCount + 1).Value
quickcount = quickcount + 1
Wend
.Height = PosH
.Width = PosW
.Left = PosL
.Top = PosTop
.Value = Worksheets(2).Cells(counter, TempCount + 1).Value
.Font.Size = 8
.Locked = True
.TextAlign = 3
.TabStop = False
.AutoSize = True
.MatchRequired = True
If cNewComboBox.Width < 82.25 Then
.AutoSize = False
.Width = 82.25
End If
End With
This all occurs with a large while loop. Thus each pass by this it will create a new combobox. I also adjust the PosL after each box, so they aren't on top of each other. It also uses some Public Variables.
The reason I'm trying to set a variable equal to all the comboboxes in the form is because I have no idea how many will be created. My ultimate goal is to simply change the ".locked = true" to ".locked = false". The user will select an "edit" button which then unlocks the boxes for editing.
Anybody know what code I should use?