LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Worksheet_Calculate fires for every worksheet in book?

Hi,

I'm moving from Excel 97 to Excel 2007 and some things have broken :-(

I have a workbook containing many worksheets. Some of those worsheets have a
Worksheet_Calculate routine more or less identical to this, a simple
GoalSeek.
----------------------------------------
Option Explicit
Private Sub Worksheet_Calculate()
Dim isOn As Boolean
isOn = Application.EnableEvents
Application.EnableEvents = False
On Error Resume Next
' A2 = input initial
' H3 = left asymptote
' F2 = initial calculated from goalseek by changinging left asymptote
Range("F2").GoalSeek Goal:=Range("A2"), ChangingCell:=Range("H3")
Application.EnableEvents = isOn
End Sub
-------------------
My problem is that when ANY worksheet in the workbook recalculates, ALL the
Worksheet_Calculate routines run.

I may be (probably!) being obtuse, but I can't see a reason for this
happening or a way to stop it. I don't think(!) this happened in Excel 97,
it certainly wasn't noticeable whereas now it takes a LONG time for the
calculations to finish.

The only other macro in the Workbook is (because in its principal
application this workbook is an invisible source of worksheets to be
copied)...
------------
Private Sub Workbook_BeforeClose(anArg As Boolean)
If Not (ThisWorkbook.Windows(1).Visible) Then ThisWorkbook.Saved = True
End Sub
-------------

Any hints?
Is there a setting somewhere I need to change?
Or do I have to modify all the Worksheet_Calculate() procedures to exit if
the worksheet isn't active?
If the latter, any suggestion on a neat way? (About the best I've come up
with so far is
If (ActiveSheet.Name < Range("A1").Parent.Name) Then Exit Sub

Thanks in advance,
(sorry for the necessary anonymity)

A Lurker


 
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
SetLinkOnData only fires once? [email protected] Excel Programming 0 December 3rd 07 03:08 PM
Worksheet_Change fires even when no change? [email protected] Excel Programming 3 July 4th 07 01:26 AM
Which Fires First? okrob Excel Programming 4 February 22nd 07 07:11 PM
code error after autorecover fires Datasort Excel Programming 1 October 6th 05 07:49 PM
Restrict Worksheet_Calculate() to its original worksheet !!! Carim[_3_] Excel Programming 2 April 30th 05 05:57 PM


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