View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default referencing worksheet functions

David,

The primary difference is how errors are handled. For example,
the Match function causes and error if the lookup value is not
found. If you use the syntax:

Dim Result As Variant
Result = Application.Match(123,Range("A1:A10"),0)

and 123 is not found, Result will contain an error value that you
can test with the IsError function. No special error handling
with On Error is required.

If you use the syntax,

Dim Result As Variant
Result =
Application.WorksheetFunction.Match(123,Range("A1: A10"),0)

and 123 is not found, you'll get a run time error that has to be
handled with an On Error handler.


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


"David Turner" wrote in message
...
Application.<function_name
Application.WorksheetFunction.<function_name

I've seen both syntax's offered.
Why choose one over the other?

--
David