WorksheetFunction object

The WorksheetFunction object allows you to perform calculations on the cells in a worksheet.

Creating a worksheet function

To create a WorksheetFunction object, use the WorksheetFunction property from the Application object.

{Create a WorksheetFunction object.}
wsFunction = app.WorksheetFunction;

Accessing a worksheet function

Use the WorksheetFunction object to access the worksheet functions available in Excel. In the following example, the CountA method returns the number of occurrences of the value “Air Conditioned” in the current range.

{Count the number of cells that contain the value "Air Conditioned".}
count = wsFunction.CountA(cellRange, "Air Conditioned");

The syntax for worksheet functions are listed in the help file for the Microsoft Excel Object Library.

Documentation Feedback