PC Review


Reply
Thread Tools Rate Thread

Custom Function Won't Auto-Calculate

 
 
MLT
Guest
Posts: n/a
 
      13th Jul 2010
I'm having trouble with a custom function that won't automatically
recalculate like a built-in function would. So if I make a change to
the sheet that would affect the value of this custom function, it will
only recalculate if I go into the formula bar, then press enter. F9
doesn't do the trick either. Am I missing something?
 
Reply With Quote
 
 
 
 
Charles Williams
Guest
Posts: n/a
 
      14th Jul 2010
Make sure that ALL the cells/ranges used in the Function appear in the
argument list for the function.
Excel looks at the argument list to determine when to recalculate the
function.

A poor alternative is to add Application.Volatile to the function, but
this will make the function calculate at every recalculation even when
it does not need to.

Charles Williams
Excel MVP
The Excel Calculation Site
http://www.DecisionModels.com

>I'm having trouble with a custom function that won't automatically
>recalculate like a built-in function would. So if I make a change to
>the sheet that would affect the value of this custom function, it will
>only recalculate if I go into the formula bar, then press enter. F9
>doesn't do the trick either. Am I missing something?

 
Reply With Quote
 
MLT
Guest
Posts: n/a
 
      16th Jul 2010
Forgive my ignorance. This argument calls ranges that are in multiple
other tabs. How do I write that range into the function?
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      16th Jul 2010
=myfunc(sheet1!a1:a9,'sheet 99'!x99,'even a third'!z32)



On 07/16/2010 07:53, MLT wrote:
> Forgive my ignorance. This argument calls ranges that are in multiple
> other tabs. How do I write that range into the function?


--
Dave Peterson
 
Reply With Quote
 
MLT
Guest
Posts: n/a
 
      20th Jul 2010
From Charles' post above, "Make sure that ALL the cells/ranges used in
the Function appear in the argument list for the function"

What does the syntax for that look like in the script for the function?
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      21st Jul 2010
If the formula looks something like:

=myfunc(sheet1!a1:a9,'sheet 99'!x99,'even a third'!z32)

Then the VBA code could look like:

Function myFunc(rng1 as range, rng2 as range, rng3 as range) as Double
(or As Variant or As Long or As String or ...)

But this is all a guess. You've never shared what your function looks like and
what it does.

On 07/20/2010 17:50, MLT wrote:
> From Charles' post above, "Make sure that ALL the cells/ranges used in
> the Function appear in the argument list for the function"
>
> What does the syntax for that look like in the script for the function?


--
Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a custom function to interpret another custom engine func Ryan Microsoft Excel Programming 0 3rd Mar 2008 07:18 PM
How do I custom calculate within a PivotTable? =?Utf-8?B?TGVhcm5pbmc=?= Microsoft Excel Worksheet Functions 1 29th May 2007 09:24 PM
Creating a Custom Excel Function to Calculate Gini Coefficients jdgarrity@gmail.com Microsoft Excel Worksheet Functions 3 21st Feb 2006 10:15 PM
Custom Function not being auto calculated when cells change..help? =?Utf-8?B?QWxleCBXb2xmZg==?= Microsoft Excel Worksheet Functions 4 22nd Mar 2005 07:06 PM
Auto/Re-Calculate user function Brian K. Sheperd Microsoft Excel Programming 6 22nd Feb 2005 01:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:22 PM.