M
MAX
I have a workbook with 3 sheets and sheet 1 has cell A1 as a blinking cell (
code below). Now I want also sheet 2 and sheet 3 with a blinking cell ( cell
A2 in both sheets).
This is the code:
In Workbook
Private Sub Workbook_Open()
StartBlink
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink
End Sub
In Module:
Public RunWhen As Double
Sub StartBlink()
With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
True
End Sub
Sub StopBlink()
ThisWorkbook.Worksheets("Sheet1").Range("A1").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
False
End Sub
Any help please?
Thank you.
code below). Now I want also sheet 2 and sheet 3 with a blinking cell ( cell
A2 in both sheets).
This is the code:
In Workbook
Private Sub Workbook_Open()
StartBlink
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink
End Sub
In Module:
Public RunWhen As Double
Sub StartBlink()
With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font
If .ColorIndex = 3 Then ' Red Text
.ColorIndex = 2 ' White Text
Else
.ColorIndex = 3 ' Red Text
End If
End With
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
True
End Sub
Sub StopBlink()
ThisWorkbook.Worksheets("Sheet1").Range("A1").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
False
End Sub
Any help please?
Thank you.