Vba Function Return Worksheet. For example, I have a functioning code like so. wSheet already dim'ed: Public wSheet As Worksheet. WorksheetFunction in front of the function that you wish to call.
The function declaration must be as defined above. WorksheetFunction. object to call one of the built-in Excel worksheet functions. This declared that it is an array function.
Fortunately, you can use worksheet functions to take advantage of that power when you're writing macros in VBA.
You've already met one worksheet function - Pi.
It is possible to leave off the "Application." prefix as this is a global. VBA Subs are the procedures that contain our code. Place a command button on your worksheet and add the following code lines In this chapter you will learn how to use Excel formula, Worksheet function and VBA Function by using the VBA.