Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VLookup in VB?


Is there a way to access functions in a sub ?
i'd like to use vlookup in one of my VB modules...
thanks in advanc

--
UofMo
-----------------------------------------------------------------------
UofMoo's Profile: http://www.excelforum.com/member.php...fo&userid=2648
View this thread: http://www.excelforum.com/showthread.php?threadid=39760

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VLookup in VB?

Sure is

ans = Application.VLOOKUP(val,rng,2,False)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"UofMoo" wrote in
message ...

Is there a way to access functions in a sub ?
i'd like to use vlookup in one of my VB modules...
thanks in advance


--
UofMoo
------------------------------------------------------------------------
UofMoo's Profile:

http://www.excelforum.com/member.php...o&userid=26485
View this thread: http://www.excelforum.com/showthread...hreadid=397602



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VLookup in VB?


Take a look at the WorksheetFunction method of the Application object.

It let's you access most worksheet functions in VBA.

By the way using Vlookup in VBA can sometimes be a problem, if error
are returned by the function VBA won't like it

--
Nori
-----------------------------------------------------------------------
Norie's Profile: http://www.excelforum.com/member.php...fo&userid=1936
View this thread: http://www.excelforum.com/showthread.php?threadid=39760

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default VLookup in VB?

or worksheetfunction.vlookup(val,rng,2,False)


Bob Phillips wrote:
Sure is

ans = Application.VLOOKUP(val,rng,2,False)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"UofMoo" wrote in
message ...

Is there a way to access functions in a sub ?
i'd like to use vlookup in one of my VB modules...
thanks in advance


--
UofMoo
------------------------------------------------------------------------
UofMoo's Profile:

http://www.excelforum.com/member.php...o&userid=26485
View this thread: http://www.excelforum.com/showthread...hreadid=397602


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VLookup in VB?

Easily handled,

ans = application.vlookup(....
If Iserror(ans) Then
...

or

On Error
ans = WorksheetFunction.VLookup(...
On Error Resume Next

If IsEmpty(ans) Then
...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Norie" wrote in
message ...

Take a look at the WorksheetFunction method of the Application object.

It let's you access most worksheet functions in VBA.

By the way using Vlookup in VBA can sometimes be a problem, if errors
are returned by the function VBA won't like it.


--
Norie
------------------------------------------------------------------------
Norie's Profile:

http://www.excelforum.com/member.php...o&userid=19362
View this thread: http://www.excelforum.com/showthread...hreadid=397602





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


Thanks everyone, I think i got it to work with your help!
You're the best


--
UofMoo
------------------------------------------------------------------------
UofMoo's Profile: http://www.excelforum.com/member.php...o&userid=26485
View this thread: http://www.excelforum.com/showthread...hreadid=397602

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 - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
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 06:34 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"