ComboBox problem
I get a runtime error "unspecified error" but of course it does not tell
me what caused the error.
I modified the code as you suggested (see code below). The employee list is
located on the Employee List worksheet. The RB in this case refers to the
Relief Board, column I is where that abbreviation is located.
Private Sub UserForm_Initialize()
Dim X As Long
Dim LastRow As Long
Const DataSheet As String = "Employee List"
Const GroupToFind As String = "RB"
Const NameColumn As String = "A"
Const GroupColumn As String = "I"
With Worksheets(DataSheet)
LastRow = .Cells(.Rows.Count, NameColumn).End(xlUp).Row
ComboBox1.Clear
For X = 2 To LastRow
If .Cells(X, GroupColumn).Value = GroupToFind Then
ComboBox1.AddItem .Cells(X, NameColumn).Value
End If
Next
End With
End Sub
|