Vba Function Return Worksheet. I've been perusing through various Google searches with nada results. Here, you discover how to use worksheet functions in your VBA expressions.
To create a user-defined array function in vba that returns an array, you just need to follow this syntax of UDF. In the above code, the INSTR function returns the position of the character where it finds the matching string. VBA will then take the values from these cells and return the sum total.
You've already met one worksheet function - Pi.
If you use Application, and your function generates an error it will return the error value.
Function CREATEDBY() As String 'Returns the current date, time and username Application. We also use an Excel VBA custom function (user defined function) to return the name of an Excel Worksheet. This page describes how to write your own worksheet functions in VBA.