I’m trying to update the combo box cbo_moduleName based on the selection made in cbo_moduleCode. Right now the user has to select the combo box to make their selection but I want the first value found during the loop to be automatically filled “on the fly”. Any idea on how I can achieve this? Here is my code so far:
Private Sub cbo_moduleCode_Change()
Dim lLoop As Long
' Clear the comboboxes we are about to update
Me.cbo_moduleName.Clear
' Loop through the worksheet and test each row
For lLoop = 1 To Sheets("lookupModule").Range("A" & Sheets("lookupModule").Rows.Count).End(xlUp).Row
' If the row's column A matches the combobox then add the corresponding values to other combos
If Sheets("lookupModule").Range("A" & lLoop).Value = Me.cbo_moduleCode.Value Then
Me.cbo_moduleName.AddItem Sheets("lookupModule").Range("B" & lLoop).Value
End If
Next lLoop
End Sub
To make the 1st item of
cbo_moduleNameselected when the user selection ofcbo_moduleCodechanges, here is the code