Vba Vlookup from userform textbox entry - run-time error 424

alecwarner

New Member
Joined
Aug 9, 2013
Messages
16
Trying to pull in an email address from a textbox on a userform.


Worksheet is called DATA
names are listed in column O2:O30
email addresses are listed in P2:P30


ENG = UserForm1.ComboBox2.Value ' Eng
Dim EMAIL As String
EMAIL = Application.WorksheetFunction.VLookup(ENG, Data.Range("O2:O30").Value, 1, False)
MsgBox EMAIL

I keep getting:
Run-time error '424'
Object required

any help would be appreciated?

Thanks

Alge
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Your range reference is not correct. It should be:
Code:
[COLOR=#333333]EMAIL = Application.WorksheetFunction.VLookup(ENG, [/COLOR][COLOR=#ff0000]Sheets("Data")[/COLOR][COLOR=#333333].Range("O2:O30").Value, 1, False)[/COLOR]
 
Upvote 0
Thanks

When the code is changed too:

EMAIL = Application.WorksheetFunction.VLookup(ENG, Sheets("DATA").Range("O2:O30").Value, 1, False)

I get a name from column O2:O30.

When the code is changed too:

EMAIL = Application.WorksheetFunction.VLookup(ENG, Sheets("DATA").Range("O2:O30").Value,
2​
, False)

I get run-time error 1004

?????????????

Please advise

Alge
 
Upvote 0
Range O2:O30 only has one column. 2 is not a valid column to return from a single column table.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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