Excel Vba Pass Worksheet To Function. Excel Formula We can use excel formula same as we use in excel worksheet. Like this: Public Function Test() As Variant Set Test = ActiveSheet End Function.
Edit: Then make sure that you set the return of the function as well.
In Excel Visual Basic, a set of commands to perform a specific task is placed into a procedure, which can be a Function procedure or a Sub procedure VBA procedures can be passed data via arguments , which are declared in the procedure definition.
Excel VBA Worksheets VBA Activesheet vs Worksheets, Select, Activate etc. ByRef means that you have to pass a reference to (the address of) an existing object as the argument, so it can work with that actual object; vs. Public Function Test(wrs As Worksheet, arr As Variant) As Variant. and I have main sub set ws = ThisWorkbook.








