M
MAX
Will you please tell me what's wrong with this code?
Option Explicit
Dim nextSecond
Sub startFlashing()
flashCell
End Sub
Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub
Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"
With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"
ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"
End If
If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41
ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"
ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"
End If
If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41
ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub
Option Explicit
Dim nextSecond
Sub startFlashing()
flashCell
End Sub
Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub
Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"
With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"
ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"
End If
If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41
ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
With Sheets("Serie B")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Champ"
ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Champ"
End If
If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41
ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
End If
End With
End Sub