Thread: View Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default View Code

Application.EnableEvents = False
do_your_stuff
Application.EnableEvents = True
Exit Sub
--
Gary''s Student - gsnu200740


"Mike H." wrote:

I stuck some code on the tab of a worksheet (right-click the tab and select
view code). The Sub is called worksheet_calculate and it checks for the
value of a named cell and if it does not equal zero, an error message pops
up. But the problem is that when running code I spawn a new spreadsheet and
add a bunch of data to it but after EACH LINE OF CODE the sub
worksheet_calculate sub is called. I don't know why? If i debug and look at
the spreadsheet with the worksheet_calculate sub I am not on the tab that has
the code. Any ideas?