Hi All,
I have a combobox named bfPoject2 that is created programmatically as follows:
When the user selects an item from the combobox it then populates a second combobox with a list of items using the event handler:
However, for some reason the event is not triggering the event handler! I use very similar code for bfPoject1 and bfWkPkge1 that is not added programmatically and it works fine.
All and any help appreciated!
I have a combobox named bfPoject2 that is created programmatically as follows:
Code:
Set bfProject2 = Controls.Add("Forms.ComboBox.1", bfProject2)
With bfProject2
.Top = 195
.Left = 474
.Width = 180
.List = Range(Cells(2, 4), Cells(lastRowProj, 4)).Value
.Font.Bold = False
End With
When the user selects an item from the combobox it then populates a second combobox with a list of items using the event handler:
Code:
Sub bfPoject2_Change()
Dim keyValue As Integer
If bfWkPkge2.ListCount <> 0 Then
For k = 0 To bfWkPkge2.ListCount - 1
bfWkPkge2.RemoveItem 0
Next k
End If
For i = 2 To lastRowProj
If bfPoject2.ListIndex = Cells(i, 1).Value Then
lastRowWkPack = ActiveWorkbook.Worksheets("Library").Cells(Rows.Count, 5).End(xlUp).Row
keyValue = Cells(i, 1).Value
For j = 2 To lastRowWkPack
If Cells(j, 5).Value = keyValue Then
bfWkPkge2.AddItem Cells(j, 8).Value
End If
Next j
End If
Next i
End Sub
However, for some reason the event is not triggering the event handler! I use very similar code for bfPoject1 and bfWkPkge1 that is not added programmatically and it works fine.
All and any help appreciated!