VLookup

  • Thread starter Thread starter BigMac
  • Start date Start date
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
 
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
 
Goodness, foolish me. Thank you so much!

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

Cheers!

-Mac
 
Back
Top