Using VLOOKUP in VBA with userform and combobox

scassells

New Member
Joined
Aug 8, 2018
Messages
13
Using VLOOKUP in VBA with userform and combobox

I get an error (actually two)

1) See error on msgbox

2) on the VLOOKUP lines I get "Compile error Expected: list separator or )"

I want to populate fields base on the selection from combobox

Code below:

Private Sub Combo_WO_ADD_Change()
Dim WONo As Integer
If Me.Combo_WO_ADD.Value = “” Then
' SEE ERROR Showing this line
MsgBox “WO No Can Not be Blank!!!”, vbExclamation, “WO No”
Exit Sub
End If
WONo = Combo_WO_ADD.Value
On Error Resume Next
' SEE ERROR Showing the following 14 lines
Me.text_Created.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 2, 0)
Me.combo_location.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 3, 0)
Me.combo_Status.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 4, 0)
Me.text_CDate.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 5, 0)
Me.text_mechanic.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 6, 0)
Me.combo_Category.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 7, 0)
Me.combo_permits.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 8, 0)
Me.combo_tag.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 9, 0)
Me.text_item.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 10, 0)
Me.text_subgroup.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 11, 0)
Me.text_issue.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 12, 0)
Me.text_Repair.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 13, 0)
Me.text_time = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 14, 0)
Me.text_cost.Value = Application.WorksheetFunction.VLookup(WONo, Sheets(“data”).Range(“C5:Q10000”), 15, 0)

End Sub
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,226,112
Messages
6,189,039
Members
453,521
Latest member
Chris_Hed

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