View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default UDF recalc problem between sheets

Hi Sandy
if you like mail me your example file:
email: frank[dot]kabel[at]freenet[dot]de

--
Regards
Frank Kabel
Frankfurt, Germany

"Sandy V" schrieb im Newsbeitrag
...
Charles,

I had actually looked at your page before posting, first
thing I thought of and thanks. Would not be at all
surprised if it contains the answer and I just can't see
it for looking. IsEmpty does not flag anything re
uncalculated cells, assuming I'm checking correctly. Both
my udf/Func1 and Func2 are error handled.

Frank,

Parent Object, I'll work on this. The input range array
is purely to get the row/col size of a single block of
cells, not necessarily the actual block I'm going to
process. In Func1 I set a new range var of same size but
with the address of Cell(1,1) obtained by other means.
This new range may or may not be on the same sheet as the
udf formula. Then I pass the new range to Func2 which is
where the error occurs.

All computed ranges relating to my udf in Sheet1 are on
same sheet. The udf in Sheet2 processs ranges in different
sheets. But it's the udf in Sheet1 that gets the error,
unless recalc is initiated in Sheet1 in which case no
errors occur anywhere. Maybe I need to be more careful
about the Sheet (ie parent).

I'm not sure that posting the code would help without
seeing it in situ in the wb, which would take an even more
convoluted explanation to describe!

Thank you both,
Sandy

-----Original Message-----
Hi Sandy
you may have to reference the parent object of your

range. Could you
post the code of your UDF

--
Regards
Frank Kabel
Frankfurt, Germany

"Sandy V" schrieb im

Newsbeitrag
...
My UDF "Func1" accepts a range array as one of its arg's
and passes this to "Func2" for intermediate processing,
works fine, except...

If I cause a recalc of udf in a formula on Sheet2

correct
result is returned. However if I switch to Sheet1, cells
with this udf show errors. If I recalc (F9) the errors
revert to correct results. Calculation is automatic and
nothing "volatile" in the wb.

What appears to be happening is when I recalc the udf in
Sheet2, udf formulas on Sheet1 are also recalculated,

but
the array arg that relates to the udf on Sheet2 is

passed
to "Func2" when the udf's on Sheet1 are being

calculated,
hence the errors.

Recalc on Sheet1 corrects, and udf's in formulas on

Sheet2
remain correct. I don't think there is a circular issue.

Debug.? .Caller.Address shows udf's in Sheet1 are
calculated before those in Sheet2, even if I initiate

the
recalc in Sheet2. Re-ordering the sheets, and/or

renaming
in different alphabetical order makes no difference. And
finally, initiating a recalc on any other sheet, even

one
without udf's, causes errors in udf's Sheet1 but not in
Sheet2. (Same scenario in XL97 & XL2K)

Hope this is not too convoluted!

TIA for any suggestions
Sandy


.