Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to work with all items in a listbox
Hi,
I have a userform that has two listboxes. Users move selected items from the listbox1 on the left, to listbox2 on the right. Items are text stings like "123456 Enzyme rev 1" Then, the user will click a command button to execute ops on items listed in listbox2. Note that i don't want it to matter if any items are selected (highlighted) in listbox2. I need the operation to be executed on all the items listed in listbox2, looping through one at a time. The value (variable) i need for an ensuing operation will be item(s) in the listbox2, one at a time. Upon clicking a command button, how do i: - create a loop that: - work with the items from the listbox2 one at a time, so i can use that value to complete an in loop operation step (the ensuing operation mentioned above). - once that step is complete, it loops back to the next item in the listbox2, and continues until all items in the listbox have been gone through. Basically, I can't figure out how to work with the items in the lisbox. Any help would be much appreciated. Thanks, Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to work with all items in a listbox
On Jan 22, 1:53*pm, SS wrote:
Hi, I have a userform that has two listboxes. *Users move selected items from the listbox1 on the left, to listbox2 on the right. *Items are text stings like "123456 Enzyme rev 1" Then, the user will click a command button to execute ops on items listed in listbox2. *Note that i don't want it to matter if any items are selected (highlighted) in listbox2. *I need the operation to be executed on all the items listed in listbox2, looping through one at a time. The value (variable) i need for an ensuing operation will be item(s) in the listbox2, one at a time. Upon clicking a command button, how do i: - create a loop that: - work with the items from the listbox2 one at a time, so i can use that value to complete an in loop operation step (the ensuing operation mentioned above). - once that step is complete, it loops back to the next item in the listbox2, and continues until all items in the listbox have been gone through. Basically, I can't figure out how to work with the items in the lisbox. Any help would be much appreciated. Thanks, Steve Maybe this can yet you started: Private Sub CommandButton1_Click() Dim i As Long, n As Long n = ListBox2.ListCount For i = 0 To n - 1 MsgBox ListBox2.List(i) Next i End Sub Note that within the userform code you do not need a variable to reference the listbox (assuming that it has already been created) and that the indexing is zero-based |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
add items to listbox | Excel Programming | |||
Edit listbox Items | Excel Programming | |||
Adding Items to a ListBox-Unique Items Only | Excel Programming | |||
Items in a Listbox | Excel Programming | |||
listing items from listbox | Excel Programming |