I have a User Defined Function that I am using to handle thousands of calculations on multiple worksheets. My UDF loads an array of values from a named range on the worksheet to preform the calculation. My issue is that the values I am pointing to on the worksheet can be different on each worksheet. When I select a new sheet the values on the ActiveSheet get applied to my UDF on all worksheets in the background. Is there an object I can reference to use the values that reside on the same worksheet as the UDF? Or some other work around?
I have multiple users that will use this UDF, so I want to limit the number of variables that need entered into the formula bar.
Here is a simplified chunk of my code:
Dim MyArray as Variant
MyArray = Range("myNamedRange")
If "this" then MyValue = MyArray (1,1)
If "that" then MyValue = MyArray (1,2)
I have multiple users that will use this UDF, so I want to limit the number of variables that need entered into the formula bar.
Here is a simplified chunk of my code:
Dim MyArray as Variant
MyArray = Range("myNamedRange")
If "this" then MyValue = MyArray (1,1)
If "that" then MyValue = MyArray (1,2)