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: 411
Default How to loop through multi-selection listbox?

Hi,

In an Excel 2000 spreadsheet on Windows XP,
I have a multi-selection listbox, lbxQuanity, on UserForm2 that
displays numbers from 1 to 12500.

This is so the employee can choose the quantities in a quote
calculation. A customer could request pricing for up to 3 quantities
for each price break.

These are the 10 price breaks:
1-9, 10-19, 20-49, 50-99, 100-249, 250-499, 500-999,
1000-2499, 2500-4999, 5000 & Up

I need to populate cells with the quantities the employee has
selected.

The first selection in price break 1-9 should populate cell E83
The second selection if there is one for this price break should
populate cell E89.
And the third selection, if there is one, should populate cell E95

Any selections in the next price break, 10-19, would populate
F83, F89 and F95.

The selections for price break 20-49 would populate G83, G89 and G95.
And so on for each price break.

In the click event of a command button, CommandButton1, I've
begun with the following code:

'The message boxes are there just for testing.

Private Sub CommandButton1_Click()
Dim i As Integer 'counter
Dim NothingThere As Boolean 'flag for no selection
NothingThere = True
For i = 0 To lbxQuantity.ListCount - 1 'loop the list
If lbxQuantity.Selected(i) Then
MsgBox lbxQuantity.List(i) & " is selected. Action here."
NothingThere = False
End If
Next
If NothingThere = True Then
MsgBox "No selection is made, whatever here"
End If
End Sub

I don't know which order to test which price break the selection
belongs in.

I don't know how to determine how many selections exist for each price
break so I can place the value in the appropriate cell.

Does anyone have any suggestions?

Thanks,

Dan Dungan
 
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
Listbox Multi Select MikeT Excel Programming 2 July 27th 06 08:25 PM
Multi Selection in a ListBox Claus Mygind Excel Programming 3 April 27th 05 03:23 PM
Multi-select listbox help! John[_60_] Excel Programming 3 October 9th 04 01:57 AM
Listbox multi selection Jorge Rodrigues Excel Programming 3 September 7th 04 11:06 PM
multi select listbox Paul Mueller Excel Programming 2 June 10th 04 09:08 PM


All times are GMT +1. The time now is 09:42 PM.

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

About Us

"It's about Microsoft Excel"