Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default 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
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
add items to listbox Baha Excel Programming 1 November 24th 06 01:44 AM
Edit listbox Items vandaley Excel Programming 0 October 8th 06 10:26 AM
Adding Items to a ListBox-Unique Items Only jpendegraft[_14_] Excel Programming 2 May 2nd 04 02:27 AM
Items in a Listbox Todd Huttenstine Excel Programming 1 April 26th 04 03:36 PM
listing items from listbox Gerry[_5_] Excel Programming 2 October 18th 03 02:45 AM


All times are GMT +1. The time now is 10:53 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"