benfitz1989
New Member
- Joined
- Jun 3, 2015
- Messages
- 2
I am trying to write a code for flashing cell in Microsoft excel 2010.
I am using a code found online to do this however I continually get an error, the bold line
Runtime error '1004'
Method 'OnTime' of object'_Application' failed
Dim NextTime As Date
Sub StartFlash()
NextTime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Styles("Flashing").Font
If .ColorIndex = xlAutomatic Then .ColorIndex = 3
.ColorIndex = 5 - .ColorIndex
End With
Application.OnTime NextTime, "StartFlash"
End Sub
Sub StopFlash()
Application.OnTime NextTime, "StartFlash", schedule:=False
ActiveWorkbook.Styles("Flashing").Font.ColorIndex = xlAutomatic
End Sub
I am using a code found online to do this however I continually get an error, the bold line
Runtime error '1004'
Method 'OnTime' of object'_Application' failed
Dim NextTime As Date
Sub StartFlash()
NextTime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Styles("Flashing").Font
If .ColorIndex = xlAutomatic Then .ColorIndex = 3
.ColorIndex = 5 - .ColorIndex
End With
Application.OnTime NextTime, "StartFlash"
End Sub
Sub StopFlash()
Application.OnTime NextTime, "StartFlash", schedule:=False
ActiveWorkbook.Styles("Flashing").Font.ColorIndex = xlAutomatic
End Sub