Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default recalculation of a custom function in excel

I've created a custom function in Excel 2003 to meet a need that's too
complicated to be feasible in a formula. When I initially create the formula
that references my function, the cell containing the formula calculates
correctly. However, when the underlying data changes, the output of the
formula does not change. Manually triggering a recalc of the worksheet via
F9, CNTL+SHIFT+ALT+F9, etc. don't update the result either. I know that the
formula is not recalcing, because I've got a breakpoint in my function, and
the VBA is not being called. The only time that the VBA executes is when a
formula that calls the function is first created.

Is there something special about recalculating cells containing custom
functions that affects how they recalculate? Is there something else I need
to be doing?

Thanks,
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default recalculation of a custom function in excel

put the following line of code at the beginning of your custom function:

Application.Volatile
--
Kevin Backmann


"Mark VII" wrote:

I've created a custom function in Excel 2003 to meet a need that's too
complicated to be feasible in a formula. When I initially create the formula
that references my function, the cell containing the formula calculates
correctly. However, when the underlying data changes, the output of the
formula does not change. Manually triggering a recalc of the worksheet via
F9, CNTL+SHIFT+ALT+F9, etc. don't update the result either. I know that the
formula is not recalcing, because I've got a breakpoint in my function, and
the VBA is not being called. The only time that the VBA executes is when a
formula that calls the function is first created.

Is there something special about recalculating cells containing custom
functions that affects how they recalculate? Is there something else I need
to be doing?

Thanks,
Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default recalculation of a custom function in excel

You could put
application.Volatile

as the first command.

but this would cause it to always recalculate

Excel determines dependencies by looking at the argument list of the
function. Put all the precedent ranges in the argument list and it should
recalculate appropriately.

--
Regards,
Tom Ogilvy

"Mark VII" wrote:

I've created a custom function in Excel 2003 to meet a need that's too
complicated to be feasible in a formula. When I initially create the formula
that references my function, the cell containing the formula calculates
correctly. However, when the underlying data changes, the output of the
formula does not change. Manually triggering a recalc of the worksheet via
F9, CNTL+SHIFT+ALT+F9, etc. don't update the result either. I know that the
formula is not recalcing, because I've got a breakpoint in my function, and
the VBA is not being called. The only time that the VBA executes is when a
formula that calls the function is first created.

Is there something special about recalculating cells containing custom
functions that affects how they recalculate? Is there something else I need
to be doing?

Thanks,
Mark

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default recalculation of a custom function in excel

Thanks for the suggestion. Application.Volatile did the trick.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoiding Recalculation for a function in automatic mode Lokesh Sharma Excel Worksheet Functions 1 September 19th 06 04:52 AM
weird recalculation of user defined function timspier Excel Worksheet Functions 3 May 14th 06 05:39 AM
Recalculation of User Function when Hiding arguments Dave[_56_] Excel Programming 7 April 21st 05 11:38 AM
Recalculation on cell changes fails when using VBA function wmauss Excel Programming 2 June 10th 04 08:08 AM
How to force a recalculation of values based on custom function Wim Bartsoen Excel Programming 1 October 28th 03 03:06 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"