#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VLookup

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default VLookup

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

HIS
www.nickhodge.co.uk

"BigMac" wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VLookup

Goodness, foolish me. Thank you so much!

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

Cheers!

-Mac

Nick Hodge wrote:
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

HIS
www.nickhodge.co.uk

"BigMac" wrote in message
ups.com...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
Which is faster: VLOOKUP-worksheet or VB-array VLOOKUP? erikhs[_20_] Excel Programming 1 August 6th 06 06:18 PM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"