Question : Userform Search

I have an userform that contains a combobox (cmbDescription1).  This combobox is  multicolumn (2 columns) but only the 2nd column is showing in the combobox.  The first column contains a unique identifier from Column E on the "Data" sheet.  The second column contains a description from Column F on the "Data" sheet.  I need to take the identifier from the first column and search column E.  When that identifier is found, I need to return the value of column G into a textbox named txtInstall1.  Any help would be greatly appreciated.  Thanks!

Answer : Userform Search

Hi,
is this what you are looking for?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
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
 
combobox
 
Random Solutions  
 
programming4us programming4us