» Worksheet functions in VBA macros using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Custom Functions , Printing in VBA
VERSION - All Microsoft Excel Versions
If you have a non-English version of Excel you have to remember to use the English function names,
and that the separator sign between the function arguments always is a comma (,).
If you don't know the English function name, record a macro while you enter the function the usual way in a cell,
in the registered macro the function name will be translated to English.
When you are going to use a worksheetfunction in a macro you also have to include the Application-object.
In Excel97 you use the object Application.WorksheetFunction. Examples:
MyTotal = Application.Sum(Range("A1:A100"))
' returns the total of the values in A1:A100 in the active worksheet.
MyTotal = Application.WorksheetFunction.Sum(Range("A1:A100"))
' the same formula for Excel 97.
Book Store:
Recommended Books:
- The McGraw-Hill 36-Hour Course in Finance for Nonfinancial Managers
- How to Pay Zero Taxes (Annual)
- Cashflow Quadrant: Rich Dad's Guide to Financial Freedom
- Who Moved My Cheese? An Amazing Way to Deal with Change in Your Work and in Your Life
- What the IRS Doesn't Want You to Know: A Cpa Reveals the Tricks of the Trade
- Accounting Principles, with CD, 6th Edition
No comments have been submitted.

