PC Review


Reply
Thread Tools Rate Thread

Detecting changes in a single cell without worksheet_change?

 
 
robotman@gmail.com
Guest
Posts: n/a
 
      1st Dec 2006
I am wondering if anyone has an alternative way to detect a single cell
or column change without using the worksheet_change function?

For example, when I detect a change in one cell, I want it to change
the contents of several other cells. The problem is when it changes
the other cells then the whole worksheet_change subroutine is triggered
again and Excel gets caught up in itself.

Any ideas?!

Thanks!

John

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      1st Dec 2006
John,

You need to use Application.EnableEvents = False in your Worksheet_Change
event procedure. When EnableEvents is False, Excel doesn't run any event
procedures. So, your code would look something like

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
''''''''''''''''''''''''''''''''
' Your Code Here
''''''''''''''''''''''''''''''''
Application.EnableEvents = True
End Sub

If you have On Error statements in your code, you should ensure that they
will cause EnableEvents to be restored to True.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am wondering if anyone has an alternative way to detect a single cell
> or column change without using the worksheet_change function?
>
> For example, when I detect a change in one cell, I want it to change
> the contents of several other cells. The problem is when it changes
> the other cells then the whole worksheet_change subroutine is triggered
> again and Excel gets caught up in itself.
>
> Any ideas?!
>
> Thanks!
>
> John
>



 
Reply With Quote
 
bz
Guest
Posts: n/a
 
      1st Dec 2006
"(E-Mail Removed)" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> I am wondering if anyone has an alternative way to detect a single cell
> or column change without using the worksheet_change function?
>
> For example, when I detect a change in one cell, I want it to change
> the contents of several other cells. The problem is when it changes
> the other cells then the whole worksheet_change subroutine is triggered
> again and Excel gets caught up in itself.
>
> Any ideas?!
>
> Thanks!
>
> John
>
>


on error goto err

Application.EnableEvents = False
..... make your changes

err:Application.EnableEvents = True







--
bz

please pardon my infinite ignorance, the set-of-things-I-do-not-know is an
infinite set.

bz+(E-Mail Removed) remove ch100-5 to avoid spam trap
 
Reply With Quote
 
robotman@gmail.com
Guest
Posts: n/a
 
      14th Dec 2006
Excellent. This was driving me crazy every time I changed an cell
inside the Worksheet_Change sub.

The EnableEvents = False does the job.

Thank you!

John

 
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
Specifying cell in Worksheet_Change even Rodney Crow Microsoft Excel Programming 9 14th Feb 2008 01:21 AM
Detecting a single quote from a cells value =?Utf-8?B?Sm9obiBLZWl0aA==?= Microsoft Excel Programming 3 9th Aug 2007 06:44 PM
Worksheet_Change Not Detecting DDE Updates Trip Microsoft Excel Programming 1 10th Sep 2005 12:07 AM
Multiple Worksheet_Change(ByVal Target As Range) In Single Worksheet MathewPBennett Microsoft Excel Misc 1 23rd Dec 2003 06:11 PM
Worksheet_Change and comment in a cell GJ Microsoft Excel Programming 1 12th Dec 2003 03:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 AM.