Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

functions

ResolvedVersion 2003

Nikolas has attended:
Excel VBA Intro Intermediate course

Functions

why when i type Worksheetfunction.(any excell function) then it throws an error.
Instead when i use application.(any excel function) then it works. whats the reason that i have to use application and not worksheetfunction?

RE: functions

Hi Nikolas

Thank you for your question

worksheet functions form a collection whose parent is the application object.

Thus the correct form is (for example)

application.worksheetfunction.sum(Range("A1:A15"))

Not all worksheet functions can be accessed in this way. If a required worksheet function is not available then this is often because that function is a VB function and can be accessed by simply typing the function name eg

datediff("yyyy",date1,date2)

Hope this helps

Regards

Stephen

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Move to edge of data block

When data is held in a block, however large, use the Ctrl key with your cursors to move quickly to the far edge of the block. Works with all 4 direction keys.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.