View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
salgud salgud is offline
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.