I'm at a loss as to how I can populate particular values in a combobox based on the User's selection in a different combobox. I have 4 comboboxes (cobo_Exec, cobo_Leader, cobo_Mgr, cobo_Assoc). I have a worksheet called Names, where there are 4 columns that correspond to each combobox. What I would like to happen, is if the User selects "Tom G." from cobo_Exec, then only those people that report to Tom G. appear in the cobo_Leader list.
Everything I see on the web is using Select Case with Arrays, but I have too many variables to do this with, and values can change as people move around the organization.
I was trying this code, but I get an error of "Expected function or variable" at the c in red font.
Everything I see on the web is using Select Case with Arrays, but I have too many variables to do this with, and values can change as people move around the organization.
I was trying this code, but I get an error of "Expected function or variable" at the c in red font.
VBA Code:
Private Sub cobo_Leader_Change()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim m As Workbook
Dim mN As Worksheet
Dim i As Integer
Dim r As Range, c As Range
Dim mNLR As Long
Set m = ThisWorkbook
Set mN = m.Sheets("Names")
mNLR = mN.Range("A" & Rows.Count).End(xlUp).Row
With Me.cobo_Mgr
Set r = mN.Range("C2:C" & mNLR)
For Each c In r
If [COLOR=rgb(184, 49, 47)]c[/COLOR] = Me.cobo_Leader.value Then Me.cobo_Mgr.ListIndex = .AddItem.Offset(, -1)
Next c
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub