Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 630
- Office Version
- 365
- 2010
- Platform
- Windows
All I am wanting to do is delete the first item in combobox2 based on the selection of combobox1. What am I doing wrong. Please give a thorough explanation, so I can understand. Thank you.
VBA Code:
Private Sub UserForm_Initialize()
Dim ctrl As Control
For Each ctrl In UserForm1.Controls
If TypeName(ctrl) = "TextBox" Then ctrl.Value = ""
If TypeName(ctrl) = "ComboBox" Then
ctrl.RowSource = "Employees!A2:A" & Range("A" & Rows.Count).End(xlUp).Row
End If
Next
End Sub
VBA Code:
Private Sub ComboBox1_Change()
With Me.ComboBox1
If .ListIndex >= 0 Then
.RemoveItem Me.ComboBox2.ListIndex '[B]Error occurs on this line[/B]
End If
End With
End Sub