How do I select different sheets from within a function?
I have a function that takes the parameter of a cell, and then looks up and down from that cell, and returns a value based on those values. This works fine until I select a cell on a different sheet from the cell the function is written in.
In outline it is as below;
Code
Option Explicit
'// Test Function
Public Function testfunction(targetcell As Variant, par1 As Integer, par2 As Integer) As Double
Dim row%, column%
row= targetcell.row
column = targetcell.column
testfunction = Cells(row, column) / (Cells(row - par1, column) + Cells(row + par2, column))
End Function
Display More
Thanks