VBA - Vlookup failing

Cred69

New Member
Joined
Jan 8, 2015
Messages
20
I have added this Vlookup code per a Combobox change.

Code:
TextBox18.Value = Application.WorksheetFunction.VLookup(TextBox2, Sheet2.Range("H7:L47"), 3, False)
TextBox19.Value = Application.WorksheetFunction.VLookup(TextBox2, Sheet2.Range("H7:L47"), 2, False)
When in the form it works exactly the way I want it too. I make a change in the combobox and Textbox18 updates to correct horsepower rating. When I click to have the data entered into the spreadsheet it fails on this vlookup command. I don't understand why or a solution to resolve it. I am not having any of the data in the textbox written its just a visual for the user to know what HP rating they are getting per the selection.

Here is the full combobox code:
Code:
Private Sub ComboBox2_Change()

    With Me
        .ComboBox13.ListIndex = -1 = .ComboBox2.ListIndex <> -1
    End With
    
'Engine P/N
y = ComboBox2.Text
TextBox2.Value = y


TextBox18.Value = Application.WorksheetFunction.VLookup(TextBox2, Sheet2.Range("H7:L47"), 3, False)
TextBox19.Value = Application.WorksheetFunction.VLookup(TextBox2, Sheet2.Range("H7:L47"), 2, False)
   
End Sub
Thanks,
Scott
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Watch MrExcel Video

Forum statistics

Threads
1,099,082
Messages
5,466,537
Members
406,485
Latest member
kaksolver

This Week's Hot Topics

Top