- Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
If Cells(11, 5) <> "In Play" Then
Cells(1, 24) = "NO"
Cells(1, 25) = ""
'Debug.Print "NO"
Application.EnableEvents = True
Exit Sub
End If
If (Cells(11, 5) = "In Play") And (Cells(1, 24) = "NO") Then
Cells(1, 24) = "WAIT"
Debug.Print "wait"
Cells(1, 25) = Cells(11, 3)
End If
If (Cells(11, 5) = "In Play") And (Cells(11, 3) - Cells(1, 25) >= TimeSerial(0, 0, 30)) And Cells(1, 24) <> "OK" _
And Cells(1, 24) = "WAIT" Then
Cells(1, 24) = "OK"
Debug.Print "ok" 'ran once - good !
Application.EnableEvents = True
Exit Sub
End If
'########################## now 20 secs into in play
If (Cells(11, 6) <> "Suspended") And (Cells(1, 24) = "OK") Then
Cells(2, 24) = "NO- sus yet"
Cells(2, 25) = ""
Debug.Print "NO- sus yet"
Application.EnableEvents = True
Exit Sub
End If
If (Cells(11, 6) = "Suspended") And (Cells(2, 24) = "NO- sus yet") Then
Cells(2, 24) = "WAIT for sus"
Debug.Print "wait"
Cells(2, 25) = Cells(11, 3)
End If
If (Cells(11, 6) = "Suspended") And (Cells(11, 3) - Cells(2, 25) >= TimeSerial(0, 0, 30)) And Cells(2, 24) <> "OK-sus" _
And Cells(2, 24) = "WAIT for sus" Then
Cells(2, 24) = "OK-sus"
Debug.Print "OK-sus"
Application.EnableEvents = True
Exit Sub
End If
Application.EnableEvents = True
End Sub
A bit rough - but works,
I want to add a check ( as a confirmation of suspended ) - basically sum(c13:m50) - is there a way to do this purely in vba ?
I reckon i am getting close to wanting to examine Col O - Mitch is there any vba code for determining the winner ? preferably I would like to grap the runners name - and copy it elsewhere
Paul