Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default UDF's & puzzling recalculation behavior

Looking for some help to better understand how excel handles recalculations
on UDF's. I've created several UDF's in a module and they work just fine, in
terms of returning the correct values. I'm passing all required arguments to
the functions. Becuase the worksheet is large and the sheet can take 10
seconds or so to recalculate, I've set the calculation mode to manual.

At times, when I open the workbook, the cells calling the UDF's are all
showing zero. F9 does not always repopulate the cells. Also, I have another
worksheet in the workbook which derives some data indirectly from the cells
calling the UDF's. If I am in that worksheet and the data looks right, and I
F9, the cells calling the UDF's fall back to zero values; same with
ctrl-alt-F9. I have gone back to the main sheet and ctrl-alt-F9 and that
seems to regenerate the right results. In my search for a solution, I've
checked the logic in the functions & have found that opening the module and
doing something as simple as adding a debug.print statement to one function
causes the worksheet to return the proper values to all the cells calling the
UDF's.

I'm sure there's a logical explanation out there, but it is lost on me so far.

Thanks!



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default UDF's & puzzling recalculation behavior

try adding the following to the udf code

application.volatile

"Brian McCarthy" wrote:

Looking for some help to better understand how excel handles recalculations
on UDF's. I've created several UDF's in a module and they work just fine, in
terms of returning the correct values. I'm passing all required arguments to
the functions. Becuase the worksheet is large and the sheet can take 10
seconds or so to recalculate, I've set the calculation mode to manual.

At times, when I open the workbook, the cells calling the UDF's are all
showing zero. F9 does not always repopulate the cells. Also, I have another
worksheet in the workbook which derives some data indirectly from the cells
calling the UDF's. If I am in that worksheet and the data looks right, and I
F9, the cells calling the UDF's fall back to zero values; same with
ctrl-alt-F9. I have gone back to the main sheet and ctrl-alt-F9 and that
seems to regenerate the right results. In my search for a solution, I've
checked the logic in the functions & have found that opening the module and
doing something as simple as adding a debug.print statement to one function
causes the worksheet to return the proper values to all the cells calling the
UDF's.

I'm sure there's a logical explanation out there, but it is lost on me so far.

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default UDF's & puzzling recalculation behavior

I thought of that, but I was afraid it would essentially negate the effect of
going to manual calculation. I'll try it.

"Duke Carey" wrote:

try adding the following to the udf code

application.volatile

"Brian McCarthy" wrote:

Looking for some help to better understand how excel handles recalculations
on UDF's. I've created several UDF's in a module and they work just fine, in
terms of returning the correct values. I'm passing all required arguments to
the functions. Becuase the worksheet is large and the sheet can take 10
seconds or so to recalculate, I've set the calculation mode to manual.

At times, when I open the workbook, the cells calling the UDF's are all
showing zero. F9 does not always repopulate the cells. Also, I have another
worksheet in the workbook which derives some data indirectly from the cells
calling the UDF's. If I am in that worksheet and the data looks right, and I
F9, the cells calling the UDF's fall back to zero values; same with
ctrl-alt-F9. I have gone back to the main sheet and ctrl-alt-F9 and that
seems to regenerate the right results. In my search for a solution, I've
checked the logic in the functions & have found that opening the module and
doing something as simple as adding a debug.print statement to one function
causes the worksheet to return the proper values to all the cells calling the
UDF's.

I'm sure there's a logical explanation out there, but it is lost on me so far.

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default UDF's & puzzling recalculation behavior

As expected, it causes a full recalc any time anything in the workbook is
changed, so that's not really desirable. Also, it dis not fix the problem
caused by recalculating when in another sheet.

"Brian McCarthy" wrote:

I thought of that, but I was afraid it would essentially negate the effect of
going to manual calculation. I'll try it.

"Duke Carey" wrote:

try adding the following to the udf code

application.volatile

"Brian McCarthy" wrote:

Looking for some help to better understand how excel handles recalculations
on UDF's. I've created several UDF's in a module and they work just fine, in
terms of returning the correct values. I'm passing all required arguments to
the functions. Becuase the worksheet is large and the sheet can take 10
seconds or so to recalculate, I've set the calculation mode to manual.

At times, when I open the workbook, the cells calling the UDF's are all
showing zero. F9 does not always repopulate the cells. Also, I have another
worksheet in the workbook which derives some data indirectly from the cells
calling the UDF's. If I am in that worksheet and the data looks right, and I
F9, the cells calling the UDF's fall back to zero values; same with
ctrl-alt-F9. I have gone back to the main sheet and ctrl-alt-F9 and that
seems to regenerate the right results. In my search for a solution, I've
checked the logic in the functions & have found that opening the module and
doing something as simple as adding a debug.print statement to one function
causes the worksheet to return the proper values to all the cells calling the
UDF's.

I'm sure there's a logical explanation out there, but it is lost on me so far.

Thanks!



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
UDF's in Excel '07 Jack Setting up and Configuration of Excel 0 November 12th 07 09:27 PM
Very puzzling - how do I reference cells without the blank rows??? ZMAN Excel Worksheet Functions 5 August 28th 06 07:36 PM
Sum help this is puzzling??????????? scott Excel Worksheet Functions 9 March 1st 06 06:49 PM
UDF's using other UDF's millsy Excel Worksheet Functions 9 December 18th 05 08:38 PM
Puzzling Format Questions Kevin H. Stecyk Excel Discussion (Misc queries) 3 May 17th 05 11:44 AM


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

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

About Us

"It's about Microsoft Excel"