Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Workbook_SheetCalculate Method

Whenever the worksheet recalculates, I call a function that I have created.
However, the function apprars to run twice even though I am calling it once.
It the worksheet calcuating more than once? How can I fix this?

Thanks in advance for your help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Workbook_SheetCalculate Method

Is your code a UDF, or called from the worksheet calculate event ?
What does your function do ?

Tim

"Chad" wrote in message
...
Whenever the worksheet recalculates, I call a function that I have
created.
However, the function apprars to run twice even though I am calling it
once.
It the worksheet calcuating more than once? How can I fix this?

Thanks in advance for your help.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Workbook_SheetCalculate Method

Calling the function is probably triggering a new recalc event and causing
the macro to rerun.

In your event code put the following at the beginning

Application.EnableEvents=False
This prevents events from triggering.

and then at the end turn back on the triggering.
Application.EnableEvents=True

If you crash or are debugging your event triggering may be left turned off
run a simple one liner to restore. (For some reason when I am testing event
triggered code I always forget this)

sub fixme()
Application.EnableEvents=true
End Sub
--
If this helps, please remember to click yes.


"Chad" wrote:

Whenever the worksheet recalculates, I call a function that I have created.
However, the function apprars to run twice even though I am calling it once.
It the worksheet calcuating more than once? How can I fix this?

Thanks in advance for your help.


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
Method "Method 'Open' of object 'Workbooks' failed [email protected] Excel Programming 2 June 2nd 10 05:28 PM
triggering Workbook_SheetCalculate Stefi Excel Programming 12 May 27th 08 11:58 AM
Workbook_SheetCalculate twice Stefi Excel Programming 0 May 20th 08 03:25 PM
Workbook_SheetCalculate Events Tom Excel Programming 3 September 3rd 06 11:35 PM
Workbook_SheetCalculate looping Hammer_757[_11_] Excel Programming 2 August 30th 05 08:39 PM


All times are GMT +1. The time now is 12:28 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"