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
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top