The code below will only work if I type "In-Play" into cell G1, but does not work when the cell simply displays "In-Play" as it does when a race goes in play.
I am guessing (I'm a beginner at this) that there is a difference in typing in a cell, and what happens when a race goes in play and the cell automatically changes to "In-Play"
Can anyone help .. mucho appreciated
regards
Paul
Code: Select all
Option Explicit
Private WithEvents App As Application
Private Sub Class_Initialize()
Set App = Application
End Sub
Private Sub App_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Const Exclude As String = "one/Two/Three"
Const StopCell As String = "G1"
Const ClearRange As String = "E120:K152"
If InStr(1, Exclude, Sh.Name, vbTextCompare) = 0 Then
With Target
If .Address = Range(StopCell).Address Then
If StrComp(Trim(.Value), "In-Play", vbTextCompare) = 0 Then
App.EnableEvents = False
Sh.Range(ClearRange).ClearContents
App.EnableEvents = True
End If
End If
End With
End If
End Sub