Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Bypass Worksheet_Change Sub

I have a Sub set up so when a user makes a change to certain fields it
validates the data. Users are able to add many rows of data and this
validation is fairly transparent to them. Occassionally data will be copied
into the current spreadsheet from another source and because of the number of
fields being simultaneously updated, the Worksheet_Change Sub takes a few
minutes to complete. I am confident the data being inserted already meets
the validation and am wondering if there is a way to Turn off the
Worksheet_Change Sub before I paste the data and then turn it back on after I
am complete?


Matt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Bypass Worksheet_Change Sub

Use the EnableEvents property. E.g.,

Application.EnableEvents = False
' your code here
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Matt" wrote in message
...
I have a Sub set up so when a user makes a change to certain
fields it
validates the data. Users are able to add many rows of data
and this
validation is fairly transparent to them. Occassionally data
will be copied
into the current spreadsheet from another source and because of
the number of
fields being simultaneously updated, the Worksheet_Change Sub
takes a few
minutes to complete. I am confident the data being inserted
already meets
the validation and am wondering if there is a way to Turn off
the
Worksheet_Change Sub before I paste the data and then turn it
back on after I
am complete?


Matt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Bypass Worksheet_Change Sub

Nevermind.... Application.EnableEvents handled my problem.

Thanks anyway.

"Matt" wrote:

I have a Sub set up so when a user makes a change to certain fields it
validates the data. Users are able to add many rows of data and this
validation is fairly transparent to them. Occassionally data will be copied
into the current spreadsheet from another source and because of the number of
fields being simultaneously updated, the Worksheet_Change Sub takes a few
minutes to complete. I am confident the data being inserted already meets
the validation and am wondering if there is a way to Turn off the
Worksheet_Change Sub before I paste the data and then turn it back on after I
am complete?


Matt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Bypass Worksheet_Change Sub

As with any application setting make sure to use an error handler to reset
the setting in case of a crash.
sub Whatever()
on error goto errorhandler
Application.EnableEvents = False
' your code here
ErrorHandler:
Application.EnableEvents = True
exit sub
--
HTH...

Jim Thomlinson


"Matt" wrote:

Nevermind.... Application.EnableEvents handled my problem.

Thanks anyway.

"Matt" wrote:

I have a Sub set up so when a user makes a change to certain fields it
validates the data. Users are able to add many rows of data and this
validation is fairly transparent to them. Occassionally data will be copied
into the current spreadsheet from another source and because of the number of
fields being simultaneously updated, the Worksheet_Change Sub takes a few
minutes to complete. I am confident the data being inserted already meets
the validation and am wondering if there is a way to Turn off the
Worksheet_Change Sub before I paste the data and then turn it back on after I
am complete?


Matt

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bypass an Ken Loomis Excel Programming 4 July 3rd 05 04:34 PM
Bypass worksheet_change event Dr.Schwartz Excel Programming 3 May 27th 05 02:20 PM
Bypass macros in Read only Lawlera Excel Programming 2 November 27th 03 10:46 AM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"