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

What's the difference between Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference I've found is
that when the Vlookup fails, Application.WorksheetFunction.Vlookup returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot of typing if
I didn't have to use it.

--
Regards,
Fred
Please reply to newsgroup, not e-mail



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Worksheetfunction

If I recall correctly, when MS introduced Worksheetfunction the
accompanying documentation indicated that the other (direct) way would
be made obsolete at some point in the future.

As far as "a lot of typing" goes, if you use VBE's intellisense
capability it is three or four keystrokes -- a bargain if MS actually
delivers on its promise and makes use of Worksheetfunction mandatory.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2004

In article ,
says...
What's the difference between Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference I've found is
that when the Vlookup fails, Application.WorksheetFunction.Vlookup returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot of typing if
I didn't have to use it.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Worksheetfunction

1. "Application" will not give you function names in the Intellisense
dropdown, nor will it give you an argument list for the function you type in
manually.

2. "WorksheetFunction" will do both.

2. It is not necessary to preface "WorksheetFunction" with "Application."

I hope I've saved you a few keystrokes!

--

Vasant




"Fred Smith" wrote in message
...
What's the difference between Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference I've found is
that when the Vlookup fails, Application.WorksheetFunction.Vlookup returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot of typing

if
I didn't have to use it.

--
Regards,
Fred
Please reply to newsgroup, not e-mail





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Worksheetfunction

Fred,

It depends on how you want error handling to occur, and by
extension, how you have declared the result variable.

If you omit the Worksheet function portion of the syntax, and
VLOOKUP fails, an error subtype variant is returned from the
function. If the result variable is not defined as a Variant,
you'll receive an error 13 - Type Mismatch (error trapping code
should be in place to handle this). If the return variable is in
fact declared as a Variant, it will contain an error value, and
you can test for this with IsError.

If you include the Worksheet function portion of the syntax, and
VLOOKUP fails, an error (1004) is immediately raised, and you'll
need error trapping code to handle this error.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Fred Smith" wrote in message
...
What's the difference between

Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference

I've found is
that when the Vlookup fails,

Application.WorksheetFunction.Vlookup returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot

of typing if
I didn't have to use it.

--
Regards,
Fred
Please reply to newsgroup, not e-mail





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 623
Default Worksheetfunction

Thanks for the tip on the unnecessary "Application".

As for Intellisense, as a touch typist, I find it very distracting. It
certainly doesn't save me any time (I can type faster than the time it takes
to figure out what delimiter or cursor action will get VBE to select the
choice). However, it is useful in seeing a list of valid choices, except
there are too many exceptions to its lists.

--
Regards,
Fred
Please reply to newsgroup, not e-mail


"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
1. "Application" will not give you function names in the Intellisense
dropdown, nor will it give you an argument list for the function you type

in
manually.

2. "WorksheetFunction" will do both.

2. It is not necessary to preface "WorksheetFunction" with "Application."

I hope I've saved you a few keystrokes!

--

Vasant




"Fred Smith" wrote in message
...
What's the difference between Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference I've found

is
that when the Vlookup fails, Application.WorksheetFunction.Vlookup

returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot of

typing
if
I didn't have to use it.

--
Regards,
Fred
Please reply to newsgroup, not e-mail









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

Thanks, Chip. Exactly the information I needed.

--
Regards,
Fred
Please reply to newsgroup, not e-mail


"Chip Pearson" wrote in message
...
Fred,

It depends on how you want error handling to occur, and by
extension, how you have declared the result variable.

If you omit the Worksheet function portion of the syntax, and
VLOOKUP fails, an error subtype variant is returned from the
function. If the result variable is not defined as a Variant,
you'll receive an error 13 - Type Mismatch (error trapping code
should be in place to handle this). If the return variable is in
fact declared as a Variant, it will contain an error value, and
you can test for this with IsError.

If you include the Worksheet function portion of the syntax, and
VLOOKUP fails, an error (1004) is immediately raised, and you'll
need error trapping code to handle this error.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Fred Smith" wrote in message
...
What's the difference between

Application.WorksheetFunction.Vlookup and
Application.Vlookup?

As far as I can tell they both work. However, one difference

I've found is
that when the Vlookup fails,

Application.WorksheetFunction.Vlookup returns
nothing, but Application.Vlookup returns N/A.

Is there any need to use WorksheetFunction? It would save a lot

of typing if
I didn't have to use it.

--
Regards,
Fred
Please reply to newsgroup, not e-mail







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
WorksheetFunction help Ayo Excel Discussion (Misc queries) 2 July 20th 08 10:48 PM
Can't use WorksheetFunction Yossi Excel Discussion (Misc queries) 5 January 25th 06 10:07 PM
Max WorksheetFunction solo Excel Programming 4 February 23rd 04 10:17 PM
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? Etien[_2_] Excel Programming 3 January 13th 04 04:07 PM
WorksheetFunction Mike Fogleman Excel Programming 2 January 1st 04 11:17 PM


All times are GMT +1. The time now is 06:56 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"