Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Request macro code - when cell change event | Excel Programming | |||
Update scrollbar in code without causing change event | Excel Programming | |||
Need code for simple change event | Excel Programming | |||
Excel 2000 ComboBox Code Change event | Excel Programming |