I have a function that looks something like this:
Function my_function(var_number As Long, a As Variant, b As Variant, c As Variant)
'do some calculations here, then:
'Function output:
Select Case var_number
Case 1
my_function = output_1
Case 2
my_function = output_2
Case 3
my_function = output_3
Case Else
my_function = 0
End Select
End Function
Then to run the function and get an output, I would do this: x = my_function(1, a, b, c) to get output_1, y = my_function(2, a, b, c) to get output_2, and so on. This, however, involves running the function every time I need to calculate one of the 3 outputs. I there a way to output ALL function results at ounce as a vector/array somehow, but by running the function only once instead of 3 separate times?
The code is massive, and I need to be able to run it as efficiently as possible, so each millisecond matters. The resulting vector/array does not need to be transferred to the spreadsheet, but will only be used within the VB code.
Bookmarks