Private Sub UserForm_Initialize()
Dim sh As Worksheet
Set sh = Worksheets("Data")
Dim i As Integer
i = 0
Do While sh.Cells(i + 1, "E") <> ""
With Me.cmbDescription1
.BoundColumn = 1
.AddItem
.List(i, 0) = sh.Cells(i + 1, "E")
.List(i, 1) = sh.Cells(i + 1, "F")
End With
i = i + 1
Loop
End Sub
Private Sub cmbDescription1_Click()
Call findInColumnG(Me.cmbDescription1.Value)
End Sub
Private Sub findInColumnG(id As String)
Dim sh As Worksheet
Dim i As Integer
Dim sText As String
Set sh = Worksheets("Data")
i = 1
Do While sh.Cells(i, "E") <> ""
If sh.Cells(i, "E") = id Then
Me.txtInstall1.Text = sh.Cells(i, "G")
Exit Do
End If
i = i + 1
Loop
End Sub
|