Home |
Search |
Today's Posts |
#15
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Listbox Multi Select | Excel Programming | |||
Multi Selection in a ListBox | Excel Programming | |||
Multi-select listbox help! | Excel Programming | |||
Listbox multi selection | Excel Programming | |||
multi select listbox | Excel Programming |