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