Hi !!
I have this code I have been using which fills up a textbox dependent on a selection from a combobox. Currently I have been trying to modify it to be able to fill the textbox based on the selection from the combination of 2 or more comboboxes. For example, if I have:
ComboBox1 = First Name
ComboBox2 = Last Name
and from those two combobox I want to automatically fill my textbox
TextBox1 = Account#
Here is the code I have up until now, it does not debug or come with error, but it does not fill my textbox with anything.
Private Sub ComboBox9_Change()
'Automatically input job name based on the client, account #, and sub-account # entered
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Recurrent Job Trail")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If ws.Cells(i, "B").Value = (Me.ComboBox1) And ws.Cells(i, "C").Value = (Me.ComboBox8) And ws.Cells(i, "D").Value = (Me.ComboBox9) Or _
ws.Cells(i, "B").Value = Val(Me.ComboBox1) And ws.Cells(i, "C").Value = Val(Me.ComboBox8) And ws.Cells(i, "D").Value = Val(Me.ComboBox9) Then
Me.TextBox8 = ws.Cells(i, "A").Value
End If
Next i
End Sub
I have this code I have been using which fills up a textbox dependent on a selection from a combobox. Currently I have been trying to modify it to be able to fill the textbox based on the selection from the combination of 2 or more comboboxes. For example, if I have:
ComboBox1 = First Name
ComboBox2 = Last Name
and from those two combobox I want to automatically fill my textbox
TextBox1 = Account#
Here is the code I have up until now, it does not debug or come with error, but it does not fill my textbox with anything.
Private Sub ComboBox9_Change()
'Automatically input job name based on the client, account #, and sub-account # entered
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Recurrent Job Trail")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If ws.Cells(i, "B").Value = (Me.ComboBox1) And ws.Cells(i, "C").Value = (Me.ComboBox8) And ws.Cells(i, "D").Value = (Me.ComboBox9) Or _
ws.Cells(i, "B").Value = Val(Me.ComboBox1) And ws.Cells(i, "C").Value = Val(Me.ComboBox8) And ws.Cells(i, "D").Value = Val(Me.ComboBox9) Then
Me.TextBox8 = ws.Cells(i, "A").Value
End If
Next i
End Sub