Vba Use Worksheet Function. If I try to use it in the worksheet as shown above, I get the #NAME? error. The function sits in the ThisWorkbook module.
The only worksheet functions that you cannot use are those that have an equivalent VBA function. So we will use the functions as -. You can use VBA function same as we use worksheet function.
Because VBA is used by many applications beyond Excel, the Excel worksheet functions are not part of the VBA language itself.
Worksheet function in VBA is used when we have to refer to a specific worksheet, normally when we create a module the code executes in the currently active sheet of the workbook but if we want to execute the code in the specific worksheet we use worksheet function, this function has various.
However, you can call worksheet functions directly through the Application object or through the Application. Most worksheet functions like VLOOKUP, MAX and SUM may be used directly in VBA code. But all the functions that are available through the main Excel screen can also be accessed using VBA code.