I
IT_roofer
I have a userform with a _bunch_ of checkboxes on several different pages of
a UserForm...
On the last page of the Userform are 24 multi-column comboboxes with
corresponding labels that are used for calculations...
Every time I check/uncheck a box somewhere in the userform, an item gets
added to a *single* combo on that last page (not all work yet - still adding
code to them). What I would like to do is have that single checked/unchecked
item be added/removed to all 24 combos on the last page..
It's kind of hard to explain, I guess. Below is the code I came up with to
add/remove items to/from *one* combo. I would like help with adding to this
code to include all combos 1-24. I'm thinking a for...next loop would do it,
but I'm terrible with loops. I usually crash machines when I try to program
them and I was extremely happy when I came up with the code that
adds/removes... so go easy on me! (ok, ok here's the code)
Public getCount, Counter, Check
Private Sub s4500_Click()
If s4500.Value = True Then
getCount = calcbox.ListCount
With calcbox
.AddItem "Tearoff Existing"
.List(getCount, 1) = rd_totalsqs.Text
End With
s4500a.Enabled = True
s4500a.Text = rd_totalsqs.Text
s4500b.Enabled = True
Else
Check = False
Counter = 0
getCount = calcbox.ListCount
Do
Do While Counter <> getCount
If calcbox.List(Counter, 0) = "Tearoff Existing" Then
calcbox.RemoveItem (Counter)
Check = True
Exit Do
Else
Counter = Counter + 1
End If
Loop
Loop Until Check = True
s4500a.Enabled = False
s4500a.Text = "0000"
s4500b.Enabled = False
End If
End Sub
a UserForm...
On the last page of the Userform are 24 multi-column comboboxes with
corresponding labels that are used for calculations...
Every time I check/uncheck a box somewhere in the userform, an item gets
added to a *single* combo on that last page (not all work yet - still adding
code to them). What I would like to do is have that single checked/unchecked
item be added/removed to all 24 combos on the last page..
It's kind of hard to explain, I guess. Below is the code I came up with to
add/remove items to/from *one* combo. I would like help with adding to this
code to include all combos 1-24. I'm thinking a for...next loop would do it,
but I'm terrible with loops. I usually crash machines when I try to program
them and I was extremely happy when I came up with the code that
adds/removes... so go easy on me! (ok, ok here's the code)
Public getCount, Counter, Check
Private Sub s4500_Click()
If s4500.Value = True Then
getCount = calcbox.ListCount
With calcbox
.AddItem "Tearoff Existing"
.List(getCount, 1) = rd_totalsqs.Text
End With
s4500a.Enabled = True
s4500a.Text = rd_totalsqs.Text
s4500b.Enabled = True
Else
Check = False
Counter = 0
getCount = calcbox.ListCount
Do
Do While Counter <> getCount
If calcbox.List(Counter, 0) = "Tearoff Existing" Then
calcbox.RemoveItem (Counter)
Check = True
Exit Do
Else
Counter = Counter + 1
End If
Loop
Loop Until Check = True
s4500a.Enabled = False
s4500a.Text = "0000"
s4500b.Enabled = False
End If
End Sub