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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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,215,149
Messages
6,123,311
Members
449,095
Latest member
Chestertim

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