Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default User Defined Function Not Does Not AutoCalc

Hi,

I have created a user defined function that is stored in my personal
macro workbook. When I change a value in one of the referenced cells,
the result does not recalc. AutoCalc is set to true in Tools --
Options, but I still need to F9 to see the resulting value. (Excel
2003.)

Any help you can lend on this is appreciated.

Henry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default User Defined Function Not Does Not AutoCalc

If you post the UDF code we can take a look:
The most likely cause is the UDF referencing directly or indirectly cells
that are in the UDF arguemnt/parameter list.


Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Henry Stockbridge" wrote in message
...
Hi,

I have created a user defined function that is stored in my personal
macro workbook. When I change a value in one of the referenced cells,
the result does not recalc. AutoCalc is set to true in Tools --
Options, but I still need to F9 to see the resulting value. (Excel
2003.)

Any help you can lend on this is appreciated.

Henry



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default User Defined Function Not Does Not AutoCalc

Always post your code

Did you include all input to the UDF in the argument list? Excel is not
aware of any "direct" references from inside the function to worksheet cells
or ranges, so then it doesn't recalculate.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Henry Stockbridge" wrote in message
...
Hi,

I have created a user defined function that is stored in my personal
macro workbook. When I change a value in one of the referenced cells,
the result does not recalc. AutoCalc is set to true in Tools --
Options, but I still need to F9 to see the resulting value. (Excel
2003.)

Any help you can lend on this is appreciated.

Henry


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default User Defined Function Not Does Not AutoCalc

Are you sure that the cell being changed is a parameter to the
function? For example,

Function Times10(D As Double) As Double
Times10 = D*10
End Function

called in a formula as =Times10(A1)

will calculate when A1 is changed. However,

Function Times20() As Double
Times20 = Range("A1") * 10
End Function

will not calculate when A1 is changed because Excel has no knowledge
of what cells might be referenced within the VBA code.

You could add Application.Volatile to the function, which would cause
the function to be calculated any time any calculation is made:

Function Times10(D As Double) As Double
Application.Volatile True
Times10 = D*10
End Function

This can, however, add unnecessary overhead to the calculation cycle
because Times10 would be calculated even if it is not necessary.

And double check the Calculation setting in Tools - Options just to
be doubly sure.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]




On Tue, 15 Dec 2009 14:22:12 -0800 (PST), Henry Stockbridge
wrote:

Hi,

I have created a user defined function that is stored in my personal
macro workbook. When I change a value in one of the referenced cells,
the result does not recalc. AutoCalc is set to true in Tools --
Options, but I still need to F9 to see the resulting value. (Excel
2003.)

Any help you can lend on this is appreciated.

Henry

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default User Defined Function Not Does Not AutoCalc

On Dec 15, 4:54*pm, Chip Pearson wrote:
Are you sure that the cell being changed is a parameter to the
function? *For example,

Function Times10(D As Double) As Double
* * * * Times10 = D*10
End Function

called in a formula as =Times10(A1)

will calculate when A1 is changed. However,

Function Times20() As Double
* * * * Times20 = Range("A1") * 10
End Function

will not calculate when A1 is changed because Excel has no knowledge
of what cells might be referenced within the VBA code.

You could add Application.Volatile to the function, which would cause
the function to be calculated any time any calculation is made:

Function Times10(D As Double) As Double
* * * * Application.Volatile True
* * * * Times10 = D*10
End Function

This can, however, add unnecessary overhead to the calculation cycle
because Times10 would be calculated even if it is not necessary.

And double check the Calculation setting in Tools - Options just to
be doubly sure.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLCwww.cpearson.com
[email on web site]

On Tue, 15 Dec 2009 14:22:12 -0800 (PST), Henry Stockbridge



wrote:
Hi,


I have created a user defined function that is stored in my personal
macro workbook. *When I change a value in one of the referenced cells,
the result does not recalc. *AutoCalc is set to true in Tools --
Options, but I still need to F9 to see the resulting value. *(Excel
2003.)


Any help you can lend on this is appreciated.


Henry- Hide quoted text -


- Show quoted text -


=====================

All set now. It was a parameter value issue, as suspected. Thank you.
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
Using dcount function within user-defined worksheet function pongthai Excel Programming 3 January 15th 07 09:55 AM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 08:50 AM.

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"