functions

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Functions

Functions

resolvedResolved · Low Priority · Version 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:

Validating text entries

1. Select the range of cells.
2. From the Data menu, select Validation.
3. Select the Settings tab.
4. From the Allow dropdown list, select Custom.
5. In the Formula box, enter the following formula:

=IsText (A1)

where A1 is the first cell in the range.
6. Click OK.

View all Excel hints and tips


Server loaded in 0.08 secs.