LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Question about a tricky Do...While loop

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tricky Macro Question Philip Excel Worksheet Functions 4 December 30th 09 05:40 PM
Tricky Ranking Question SteveC Excel Discussion (Misc queries) 1 August 24th 07 03:11 AM
Tricky comparing question Corben Excel Worksheet Functions 3 April 21st 06 10:11 PM
New guy with a tricky question Arian Goodwin Excel Programming 3 November 10th 05 03:45 PM
Tricky Question The Boondock Saint Excel Worksheet Functions 7 December 8th 04 07:22 PM


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"