S
smace
This is my procedure:
Private Sub DisplayProductStages()
Dim ListItems As Variant, i As Integer, j As Integer
i = 1
Do Until IsEmpty(Cells(17, i))
If Cells(17, i).Value = Range("F1").Value Then
' found the product - display the product details
j = 18
Do Until IsEmpty(Cells(j, i))
'Find the last row containing product category data
j = j + 1
Loop
ListItems = Worksheets("Sheet1").Range(Cells(18, i), Cells(j
i)).Value
Worksheets("Sheet1").ListBox1.List() = ListItems
End If
i = i + 1
Loop
End Sub
This is the code that calls it:
Private Sub ComboBox2_Change()
Worksheets("Sheet1").ComboBox2.BoundColumn = 1
Range("F1") = ComboBox2.Value
Call DisplayProductStages
End Sub
The code works (albeit slowly) when the call to the procedure was in
ComboBox2_Click() event but doesn't work in the change event. Th
IsEmpty tests work and "stop" in the right place it seems to be th
actual click event that was being called loads of times. .
Thanks for your interest
Private Sub DisplayProductStages()
Dim ListItems As Variant, i As Integer, j As Integer
i = 1
Do Until IsEmpty(Cells(17, i))
If Cells(17, i).Value = Range("F1").Value Then
' found the product - display the product details
j = 18
Do Until IsEmpty(Cells(j, i))
'Find the last row containing product category data
j = j + 1
Loop
ListItems = Worksheets("Sheet1").Range(Cells(18, i), Cells(j
i)).Value
Worksheets("Sheet1").ListBox1.List() = ListItems
End If
i = i + 1
Loop
End Sub
This is the code that calls it:
Private Sub ComboBox2_Change()
Worksheets("Sheet1").ComboBox2.BoundColumn = 1
Range("F1") = ComboBox2.Value
Call DisplayProductStages
End Sub
The code works (albeit slowly) when the call to the procedure was in
ComboBox2_Click() event but doesn't work in the change event. Th
IsEmpty tests work and "stop" in the right place it seems to be th
actual click event that was being called loads of times. .
Thanks for your interest