Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub ComboBox1_Change()
If Me.ComboBox1.Value = "" Then Exit Sub
Dim i As Long
Dim StrWs$
StrWs = Me.ComboBox1.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
With Me.ComboBox2
.Clear
For i = 2 To Sheets(StrWs).Range("A" & Sheets(StrWs).Rows.Count).End(xlUp).Row
.AddItem Sheets(StrWs).Range("A" & i)
.List(.ListCount - 1, 1) = Sheets(StrWs).Range("B" & i)
.List(.ListCount - 1, 2) = Sheets(StrWs).Range("C" & i)
Next
End With
End Sub
Private Sub ComboBox2_Change()
Application.ScreenUpdating = True
With Me
.TextBox1.Value = ""
.TextBox2.Value = ""
.TextBox3.Value = ""
With .ComboBox2
If .Value = "" Then Exit Sub
Me.TextBox1.Value = .List(.ListIndex, 0)
Me.TextBox2.Value = .List(.ListIndex, 1)
Me.TextBox3.Value = .List(.ListIndex, 2)
Application.ScreenUpdating = True
End With
End With
End Sub
Private Sub UserForm_Initialize()
With UserForm1
With .ComboBox1
.List = Array("Maintenance", "Direction")
End With
End With
End Sub