PDA

View Full Version : VBA Combobox for vlookup



Esopera
01-18-2018, 12:39 PM
I'm getting an error with the following code. I would like to use the combobox to vlookup data on a sheet, then hit a submit button to change the information. Right now I'm getting an error just running a vlookup from the combobox.

Private Sub LNameCombobox_Change()
If Me.LNAMEComboBox.Value = "" Then Exit Sub
PNTextBox.Value = Application.VLookup(Me.LNAMEComboBox.Value, Range("Sheet1!$B2:T10000"), 3, 0)
End Sub

The error is in line 3.

Any help would be greatly appreciated.

georgiboy
01-18-2018, 12:58 PM
Shouldn’t:

Range("Sheet1!$B2:T10000")

Be

Sheet1.Range("B2:T10000")

hope this helps