Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Event code to continuously monitor change

I need to continuosly monitor whenever the value of cell b1 equals or does
not equal the value of cell c1 and when it's not equal then run a macro. i
have found several answers here to similar questions but the code runs only
one time and will not activate again if the value changes back to equal and
then not equal again.

Thanks,
Ybor Tony
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Event code to continuously monitor change

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B1"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ybor Tony" <Ybor wrote in message
...
I need to continuosly monitor whenever the value of cell b1 equals or does
not equal the value of cell c1 and when it's not equal then run a macro.

i
have found several answers here to similar questions but the code runs

only
one time and will not activate again if the value changes back to equal

and
then not equal again.

Thanks,
Ybor Tony



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Event code to continuously monitor change

Hi,

In the worksheet change event of the Sheet1 type the following

If Target.Cells(1).Address = "$B$1" Or Target.Cells(1).Address = "$C$1"
Then
If Sheet1.Cells(1, 2).Value < Sheet1.Cells(1, 3) Then
'macro name goes here
End If
End If


"Ybor Tony" wrote:

I need to continuosly monitor whenever the value of cell b1 equals or does
not equal the value of cell c1 and when it's not equal then run a macro. i
have found several answers here to similar questions but the code runs only
one time and will not activate again if the value changes back to equal and
then not equal again.

Thanks,
Ybor Tony

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Event code to continuously monitor change

Here you go this will fire if either B1 or C1 is changed


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:C1")) Is Nothing Then
If Range("B1").Value = Range("C1").Value Then
Application.EnableEvents = False
'<your true code here'
End If
End If
Application.EnableEvents = True
End Sub

Sandy



Ybor Tony wrote:
I need to continuosly monitor whenever the value of cell b1 equals or does
not equal the value of cell c1 and when it's not equal then run a macro. i
have found several answers here to similar questions but the code runs only
one time and will not activate again if the value changes back to equal and
then not equal again.

Thanks,
Ybor Tony


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
Request macro code - when cell change event Rhey1971 Excel Programming 4 May 1st 06 11:46 AM
Update scrollbar in code without causing change event Sandra[_5_] Excel Programming 3 December 22nd 04 12:40 PM
Need code for simple change event Jake[_8_] Excel Programming 2 May 14th 04 11:29 PM
Excel 2000 ComboBox Code Change event Matt. Excel Programming 3 July 28th 03 03:29 PM


All times are GMT +1. The time now is 11:52 PM.

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

About Us

"It's about Microsoft Excel"