logo
search
VBA & Macro Problems

How to Call Excel Worksheet Functions from VBA

Maira MehtabMaira Mehtab Sep 22, 2026 869 views

Question details

The user wants to know how to call built-in Excel worksheet functions, specifically ROUNDDOWN, from within a VBA user-defined function or macro.

Product
Microsoft Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Writing a VBA macro or user-defined function that requires calculating values using standard worksheet formulas.
Observed behavior
The goal is to seamlessly utilize existing worksheet functions directly within the VBA object model.
Before you start

Ensure that the Developer tab is enabled in your spreadsheet application and that you are familiar with accessing the VBA Editor using the ALT + F11 shortcut.

Solution 1Recommended

Use the Application.WorksheetFunction Property

This is the standard and most robust method for calling built-in worksheet functions within VBA.

The WorksheetFunction property acts as a container for most of Excel's standard formulas, making them accessible to your VBA macros.

1
Open the VBA Editor

Press ALT + F11 on your keyboard to launch the Visual Basic for Applications editor.

2
Access Your Macro

From the Project Explorer pane on the left, double-click the Module where you want to add your code, or insert a new one via Insert > Module.

3
Call the Function

Type the code to call the function. For example: `result = Application.WorksheetFunction.RoundDown(number, num_digits)`. Replace 'number' and 'num_digits' with your actual variables or numerical values.

IntelliSense Advantage: Typing Application.WorksheetFunction triggers the VBA IntelliSense menu, which provides an auto-complete list and hints for the required arguments.
Advanced VBA Support in WPS

Run VBA Macros Seamlessly in WPS Office

WPS Spreadsheet offers robust support for VBA macros, allowing you to use the exact same Application.WorksheetFunction syntax to call built-in functions as you would in Microsoft Excel.

  1. 1. Download and Install: Get WPS Office from the official website and complete the quick installation process.
  2. 2. Open Your Workbook: Launch WPS Spreadsheet and open your existing macro-enabled workbook (.xlsm).
  3. 3. Open the VBA Editor: Go to the Developer tab on the ribbon and click on the 'VBA Editor' icon to access your code environment.
  4. 4. Run Your Code: Execute your macros containing `Application.WorksheetFunction` calls directly without needing to rewrite or modify your existing scripts.
Fully compatible with Microsoft Excel VBA syntax and objectsSupports standard WorksheetFunction calls like ROUNDDOWNLightweight software with high-speed performanceFree to download with a familiar user interface
microsoft office alternative - wps office

Frequently Asked Questions

Can I call every Excel worksheet function in VBA?

Most built-in worksheet functions can be called using Application.WorksheetFunction. However, functions that already have a native VBA equivalent (such as LEFT, RIGHT, or mathematical operators) might not be available in the WorksheetFunction object, as you are expected to use the native VBA functions instead.

What is the difference between Application.WorksheetFunction and Application?

The main difference lies in error handling. If a function called via Application.WorksheetFunction fails, it generates a VBA run-time error that must be handled with standard error trapping (e.g., On Error GoTo). Calling the function directly via the Application object returns an error value that you can test using the IsError() function.

Why doesn't IntelliSense show the function I want to use?

IntelliSense only displays functions officially supported by the VBA object model when using Application.WorksheetFunction. If you use the Application shorthand, IntelliSense may not list the worksheet functions, even though they will still execute correctly when you run the macro.