I'm trying to make a non volatile function that accepts an index and two ranges and makes certain operation on the sheet's ranges.
Unfortunately the Sheets
or Worksheets
functions make the function volatile thus each time I edit the worksheet the function starts recalculation.
Here's some pseudocode:
Function FooFunc(sheetIndex As Integer, xRange As Variant, yRange As Variant) As Variant
Dim operatingSheet As Variant
'This makes the function volatile
Set operatingSheet = Sheets("Bar " & sheetIndex)
[...]
End Function
Apparently declaring Application.Volatile (False)
doesn't seem to change anything.
As per title: is there a way to retrieve Sheets/Worksheets object without making the function volatile?