Excel VBA - Event Problems

  • Thread starter Thread starter Teggaman
  • Start date Start date
T

Teggaman

Hi I'm using a standard module to pull some data from various sources
and transferring them onto a sheet. The sheet also has some
selectionchange event code.

Unfortuatly, when updating my sheet, the event code kicks and checks
to see if the events been activated. The code still works, but takes
longer because of this.

Can I switch this off before running the import macro?

Thanks

Teggaman
 
Hi Teggaman

You disable event handling with

Application.EnableEvents = False

Be absolutely sure to set it back, when the
operation is over, with

Application.EnableEvents = True

If you don't do this Eventhandling is disabled, not
only for the workbook in question, but for the entire
Excel session.

To be on the safe side, I always do it like this:


Sub Test()

On Error Goto Finito

Application.EnableEvents = False
'code
'code
Finito:
Application.EnableEvents = True
End Sub


--
Best Regards
Leo Heuser
MVP Excel

Followup to newsgroup only please.
 
Back
Top