PC Review


Reply
Thread Tools Rate Thread

How to disable tempory an automatic Worksheet_Change Event

 
 
jmslab@kpnmail.nl
Guest
Posts: n/a
 
      9th Nov 2008
Hoi,

I'm using a macro to copy data from file-1 to file-2.
In file-2 (which is not my file) an automatic ChangeEvent is build in
by another person on such a way that when I copy data to a specific
datafield I get an automatic popup with a question.
It's not allowed for me to change this code, but............ I don't
want that pop-up when I'm copying data into it. Is there a way I can
disable that code when I'm copying.

Something like:
'disable code for AutoEvent.....
'copy data
'enable code for AutoEvent....

below the code which I found in that file-2 as I mentioned.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ChangedRange As Range
Set ChangedRange = Range("I25:I33")
If Union(Target, ChangedRange).Address = ChangedRange.Address Then
CheckResult '=run another macro
End If
End Sub

regards,
Johan
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      9th Nov 2008
Sure, use

Application.EnableEvents = FALSE

to disable event handling and

Application.EnableEvents = TRUE

to enable event handling.

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"(E-Mail Removed)" wrote:

> Hoi,
>
> I'm using a macro to copy data from file-1 to file-2.
> In file-2 (which is not my file) an automatic ChangeEvent is build in
> by another person on such a way that when I copy data to a specific
> datafield I get an automatic popup with a question.
> It's not allowed for me to change this code, but............ I don't
> want that pop-up when I'm copying data into it. Is there a way I can
> disable that code when I'm copying.
>
> Something like:
> 'disable code for AutoEvent.....
> 'copy data
> 'enable code for AutoEvent....
>
> below the code which I found in that file-2 as I mentioned.
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim ChangedRange As Range
> Set ChangedRange = Range("I25:I33")
> If Union(Target, ChangedRange).Address = ChangedRange.Address Then
> CheckResult '=run another macro
> End If
> End Sub
>
> regards,
> Johan
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th Nov 2008
Maybe...

Application.enableevents = false
'copy data
application.enableevents = true

(E-Mail Removed) wrote:
>
> Hoi,
>
> I'm using a macro to copy data from file-1 to file-2.
> In file-2 (which is not my file) an automatic ChangeEvent is build in
> by another person on such a way that when I copy data to a specific
> datafield I get an automatic popup with a question.
> It's not allowed for me to change this code, but............ I don't
> want that pop-up when I'm copying data into it. Is there a way I can
> disable that code when I'm copying.
>
> Something like:
> 'disable code for AutoEvent.....
> 'copy data
> 'enable code for AutoEvent....
>
> below the code which I found in that file-2 as I mentioned.
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim ChangedRange As Range
> Set ChangedRange = Range("I25:I33")
> If Union(Target, ChangedRange).Address = ChangedRange.Address Then
> CheckResult '=run another macro
> End If
> End Sub
>
> regards,
> Johan


--

Dave Peterson
 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      9th Nov 2008
Joban,

You can disable events with the Application.EnableEvents setting.
E.g.,


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

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sun, 9 Nov 2008 04:06:19 -0800 (PST), (E-Mail Removed) wrote:

>Hoi,
>
>I'm using a macro to copy data from file-1 to file-2.
>In file-2 (which is not my file) an automatic ChangeEvent is build in
>by another person on such a way that when I copy data to a specific
>datafield I get an automatic popup with a question.
>It's not allowed for me to change this code, but............ I don't
>want that pop-up when I'm copying data into it. Is there a way I can
>disable that code when I'm copying.
>
>Something like:
>'disable code for AutoEvent.....
>'copy data
>'enable code for AutoEvent....
>
>below the code which I found in that file-2 as I mentioned.
>
>Private Sub Worksheet_Change(ByVal Target As Range)
>Dim ChangedRange As Range
>Set ChangedRange = Range("I25:I33")
>If Union(Target, ChangedRange).Address = ChangedRange.Address Then
>CheckResult '=run another macro
>End If
>End Sub
>
>regards,
> Johan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
More then 1 worksheet_change event John Microsoft Excel Programming 8 2nd Oct 2009 03:58 PM
Worksheet_Change Event Alectrical Microsoft Excel Programming 5 4th Sep 2009 02:54 PM
How to temp disable Worksheet_Change Event while code in same completes? EagleOne@discussions.microsoft.com Microsoft Excel Programming 4 20th Jan 2009 10:31 PM
How do I change a Worksheet_change event to a beforesave event? =?Utf-8?B?VHVlYW5rZXI=?= Microsoft Excel Programming 5 29th Jun 2007 03:00 PM
Worksheet_change event Dwayne Smith Microsoft Excel Programming 2 5th Jun 2004 03:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:14 PM.