ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   View Code (https://www.excelbanter.com/excel-programming/396564-view-code.html)

Mike H.

View Code
 
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?

Gary''s Student

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?



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com