ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VLookup in VB? (https://www.excelbanter.com/excel-programming/337877-vlookup-vbulletin.html)

UofMoo[_3_]

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


Bob Phillips[_6_]

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




Norie

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


WhytheQ

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



Bob Phillips[_6_]

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




UofMoo[_6_]

VLookup in VB?
 

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


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



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com