View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Performance tradeoffs / related followup question

Hi Keith

Yes. In theory it's like this, paste in a module:

Function MyUdf(dblA As Double) As Double
'demo only:
Debug.Print Now, dblA 'to display recalculation
MyUdf = Application.RoundDown(dblA / 3, 1)
End Function

And in a sheet, cell B1
=MyUDF(A1)
fill down to B100. Now watch the immediate window in the VB editor while
entering numbers in the A column -only the entered row is calculated.

I don't have time to invesatigate your original formula, but I hope you can
get it to work along these lines.
Array formulas may be far more tricky I guess...
--
HTH. Best wishes Harald
Followup to newsgroup only please

"Keith R" skrev i melding
news:01c3ce41$3e1a1a40$476a1bac@PC12001...
Thank you to all who have replied so far;

it sounds like I can mess with autocalculation settings, which I want to
avoid, or I can use a UDF linked to the source cell (all in column A) so
that XL doesn't update everything, every time a cell is changed.

So here's my followup question; given that I have some fairly complex
formulas (see original posting if desired), can I do either of the
following?

(1) is there any built-in way to force a formula link to the cell in

column
A, in my existing formulas, so that calculation _only_ occurs when that
cell changes, or,

(2) is there a way to build a "pass through" UDF, so that I could nest my
existing formula into the UDF and have the same effect? e.g.,

=MyUDFName(A17, (SUM(IF(ROUNDDOWN(INDIRECT(B16 & _
"!F2:F140"),0)=A16,INDIRECT(B16 & _
"!G2:G140")-INDIRECT(B16 & "!F2:F140"),"")))

I'm leaning toward option 2, but I'm not sure how that would work, given
that when I call functions from VBA I always have to use the long version,
e.g. 'Excel.worksheetfunction.functionname' instead of the formula as
written, above.

I'd still like to avoid recreating the contents of every single formula in
VBA (including as a UDF) if possible...

Many thanks,
Keith R
XL97