Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Which workbook caused calculation

I have a workbook "A" that uses the worksheet_calculate event in a
sheet. Working in other workbooks triggers the event from time to
time, and I'd like to be able to modify the event code to detect that
calculation was not triggered by working in "A" and exit.

Is this possible?

Thanks.

Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Which workbook caused calculation

On Fri, 24 Jul 2009 10:41:58 -0700 (PDT), Mark Driscol wrote:

I have a workbook "A" that uses the worksheet_calculate event in a
sheet. Working in other workbooks triggers the event from time to
time, and I'd like to be able to modify the event code to detect that
calculation was not triggered by working in "A" and exit.

Is this possible?

Thanks.

Mark


One way to do that is to set a public boolean variable (like bWSA maybe) to
true whenever Worksheet A is activated, then reset it to false when A is
deactivated. Then check the value of bWSA when the worksheet_calculate
event is triggered, like

If bWSA = true then
call yoursub
End if

Something like that. The many experts here may have simpler, or more
complex, solutions.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Which workbook caused calculation

On Jul 24, 1:08*pm, salgud wrote:
On Fri, 24 Jul 2009 10:41:58 -0700 (PDT), Mark Driscol wrote:
I have a workbook "A" that uses the worksheet_calculate event in a
sheet. *Working in other workbooks triggers the event from time to
time, and I'd like to be able to modify the event code to detect that
calculation was not triggered by working in "A" and exit.


Is this possible?


Thanks.


Mark


One way to do that is to set a public boolean variable (like bWSA maybe) to
true whenever Worksheet A is activated, then reset it to false when A is
deactivated. Then check the value of bWSA when the worksheet_calculate
event is triggered, like

If bWSA = true then
call yoursub
End if

Something like that. The many experts here may have simpler, or more
complex, solutions.


Thank you, I'll try that.

Mark
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Which workbook caused calculation

you could code the ThisWorkbook event

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

End Sub





"Mark Driscol" wrote in message
...
I have a workbook "A" that uses the worksheet_calculate event in a
sheet. Working in other workbooks triggers the event from time to
time, and I'd like to be able to modify the event code to detect that
calculation was not triggered by working in "A" and exit.

Is this possible?

Thanks.

Mark

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Which workbook caused calculation

I try and avoid using the calc event for just this reason.

You could put something like this at the top of your event code

if activeworkbook.name = thisworkbook.name then
do your stuff
Else
do nothing
end if/ end sub

That will effectively turn your code off whenever the workbook it is in
is not the active one.

Cheers
Simon
Excel development website: www.codematic.net


Mark Driscol wrote:
I have a workbook "A" that uses the worksheet_calculate event in a
sheet. Working in other workbooks triggers the event from time to
time, and I'd like to be able to modify the event code to detect that
calculation was not triggered by working in "A" and exit.

Is this possible?

Thanks.

Mark

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
What caused this? Yrrep Excel Worksheet Functions 0 March 2nd 10 12:30 AM
Problems caused during/after printing Excelibur[_6_] Excel Programming 0 January 11th 07 07:27 PM
Error caused by *.xls file WLMPilot Excel Discussion (Misc queries) 0 July 27th 06 03:09 PM
Which control caused the macro to run? josa01 Excel Programming 4 October 10th 05 02:07 PM
Sharing Workbook caused error message Joe Parisi[_2_] Excel Programming 2 October 2nd 03 04:46 PM


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

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"