Worksheet_change

  • Thread starter Thread starter Andrew haycock
  • Start date Start date
A

Andrew haycock

Hi How do i use the worksheet change sub but not have it
fire until after the report is created.

as at the moment each time a cell is written to when
report is being created it just messes up
 
If you're creating the report in code, wrap your report generation
code with

Application.EnableEvents = False
'Do report stuff here
Application.EnableEvents = True

You'll then need to have one last change to fire the
Worksheet_Change() macro.
 
Andrew haycock said:
Hi How do i use the worksheet change sub but not have it
fire until after the report is created.

as at the moment each time a cell is written to when
report is being created it just messes up

Hi Andrew,

That depends on what's writing to your cells. If you are running a VBA
program that's doing the writing and causing this event to fire, then add
the following line at the beginning of the code:

Application.EnableEvents = False

and when you are ready for the Worksheet_Change event to fire again add the
line:

Application.EnableEvents = True

If the user is entering data on the worksheet and causing the
Worksheet_Change event to fire then there isn't much you can do. This is
what the event was designed for.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Back
Top