Click event on combobox in a loop

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top