>
> I am writing my own functions to use in spreadsheets. When passing a range
> to the function I have to enclose the range in quote marks for it to work.
> How do I get around this? Also, is there an easy way to allow the function
> to accept a range from another worksheet? Currently I do this in a very
> inefficient manner. Lastly, a problem exists when using these functions in
> two worksheets simultaneously where the source range is in the first
> worksheet only - it will only seem to calculate correctly on one page at a
> time.
>
> EG
> Problem 1.
> cell formula must look like this "=myfunction("A1:A4",1)
> Rather than "=myfunction(A1:A4,1)
>
> Problem 2.
> How do I get this to work better
> cell formula "=myfunction("sheet1!A1:A4",1)
Sam,
1) To pass a range to a function declare the range as a Variant in your
function declaration:
Function myfunction(InRange As Variant, InInteger As Integer)
2) You may want to try using the Volatile method in your function to
force it to be recalculated.
Function myfunction ....
Application.Volatile
.
.
.
End Function
Good Luck!
Phil Topness