VLookup

B

BigMac

Hi, I'm totally new to VBA, so I do need some help.

Been trying to do a Vlookup function on VBA, but I keep getting Error
1001: Application-defined or object-defined error. Here's my code:



Private Sub cmdFinduser_Click()

Dim MyRange As Long
Dim colNumber As Long

MyRange = Sheets("MemberList").Range("B:0").Text

txtName.Text = Application.WorksheetFunction.VLookup(txtFOM.Text,
MyRange, 4, False)

End Sub


Thanks for the help
 
N

Nick Hodge

I don't know what txtFOM is, but presuming this is correct, you have a typo
in the range("B:O") you have a zero instead of a O

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

(e-mail address removed)
www.nickhodge.co.uk
 
B

BigMac

Goodness, foolish me. Thank you so much!

Another thing I realised that I have to set MyRange as Variant, not as
Long

Cheers!

-Mac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top