M
MAX
Will you please tell me what I have wrong with this code?
In Workbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub
Private Sub Workbook_Open()
startFlashing
End Sub
In Module:
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"
If Range("B1").Interior.ColorIndex = 36 Then
Sheet1.Range("B1").Interior.ColorIndex = 41
Sheet1.Range("B1").Value = "Light Blue"
Sheet2.Range("B1").Interior.ColorIndex = 41
Sheet2.Range("B1").Value = "Light Blue"
Sheet3.Range("B1").Interior.ColorIndex = 41
Sheet3.Range("B1").Value = "Light Blue"
ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 36
Sheet1.Range("B1").Value = "Light Yellow"
Sheet2.Range("B1").Interior.ColorIndex = 36
Sheet2.Range("B1").Value = "Light Yellow"
Sheet3.Range("B1").Interior.ColorIndex = 36
Sheet3.Range("B1").Value = "Light Yellow"
End If
End Sub
In Workbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub
Private Sub Workbook_Open()
startFlashing
End Sub
In Module:
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"
If Range("B1").Interior.ColorIndex = 36 Then
Sheet1.Range("B1").Interior.ColorIndex = 41
Sheet1.Range("B1").Value = "Light Blue"
Sheet2.Range("B1").Interior.ColorIndex = 41
Sheet2.Range("B1").Value = "Light Blue"
Sheet3.Range("B1").Interior.ColorIndex = 41
Sheet3.Range("B1").Value = "Light Blue"
ElseIf Range("B1").Interior.ColorIndex = 41 Then
Sheet1.Range("B1").Interior.ColorIndex = 36
Sheet1.Range("B1").Value = "Light Yellow"
Sheet2.Range("B1").Interior.ColorIndex = 36
Sheet2.Range("B1").Value = "Light Yellow"
Sheet3.Range("B1").Interior.ColorIndex = 36
Sheet3.Range("B1").Value = "Light Yellow"
End If
End Sub