"On open†interferes with "On Change"

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I have a work book with 15 Worksheets. This is accesses by numerous
individuals. Each sheet has "On Change" code that notes the last day and time
the any data was changed in the worksheet. I would also like to add a
function that tells me when the last time the worksheet was accessed or
opened. However when I used the on open procedure to capture this data it
also changed the "On Change" date. I want these two dates to be independent
of each other.
 
If in your on open code you make a change then it will fire your on change
event code. You can supress events with code like this.
application.enableevents = false
'make your change
application.enableevents = true

Just make darn sure taht you always reset that setting as it is a presistent
setting that is not reset by restarting XL. If you turn events off the only
way to get them back on again is via code... To that end I never use that
code without an error handler.
 
Actually, restarting Excel does reset Application.EnableEvents to True. I
just tested it to be sure.

- Jon
 
Mine doesn't... Either it is an install setting or perhaps something else.
 
I don't know of any particular installation setting that would change this.
(Doesn't mean there isn't one.) It might be version specific (I'm using 2003
SP2 or 3).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



Jim Thomlinson said:
Mine doesn't... Either it is an install setting or perhaps something else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top