LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default How to loop through multi-selection listbox?

Hi Dick,

The code seems to produce the output I was looking for now.
So now I need to add functionality that will populate the delivery
lead time associated with each quantity.

To hold the delivery lead time values, I added 10 textboxes with the
naming convention: txtDelivery2, txtDelivery3, up to txtDelivery11.

8( for eight weeks), 7( for seven weeks), etc.

If there is a value in textbox2, there will be a corresponding value
in txtDelivery2.

If Quantity falls in the first price break at cell E83, the
corresponding delivery time needs to be in cell E86

There is a 3 cells each for quantity and delivery in each price
break.

I don't understand the logic I would need for this.

What I've done here never picks up the delivery value in the
txtDelivery control. The quantity portion still returns the proper
value.

Thanks for any comments.

Dan
__________________________________________________ ____________
Private Sub CommandButton1_Click()
Dim vaBreaks As Variant
Dim i As Long
Dim ctl As Control 'Returns the value held in the quantity
textboxes
Dim j As Long 'Determine where the textbox value falls in the
price breaks
Dim lQtyCnt As Long 'to check how many quantities for each aBreak.
No more than 3 quanitities of each price break.

vaBreaks = VBA.Array(1, 10, 20, 50, 100, 250, 500, 1000, 2500,
5000, 12501)

For i = 0 To 9
lQtyCnt = 0
For j = vaBreaks(i) To vaBreaks(i + 1) - 1
For Each ctl In Me.Controls
If Left$(ctl.Name, 7) = "TextBox" Then
If ctl = j Then
lQtyCnt = lQtyCnt + 1
If lQtyCnt <= 3 Then
Sheet1.Range("e1").Offset(76 + (lQtyCnt *
6), i).Value = (ctl)
End If
If Left$(ctl.Name, 11) = "txtDelivery" Then
Sheet1.Range("e1").Offset(76 + (lQtyCnt *
9), i).Value = (ctl)
End If
End If
End If
Next ctl
Next j
Next i
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
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 01:36 AM.

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"