Morning all,
I'm not a VBA pro, so you can imagine my delight when I managed to auto start a macro, that made the test in one of my cells "blink". However, the file now opens everytime I close it - because I haven't ended my Application.OnTime and I just can't get my head round it.
So, in my "ThisWorkbook" my code looks like:
And in my module, the corresponding code looks like:
How do I make it stop when I close the file?
Thanks,
Fi
I'm not a VBA pro, so you can imagine my delight when I managed to auto start a macro, that made the test in one of my cells "blink". However, the file now opens everytime I close it - because I haven't ended my Application.OnTime and I just can't get my head round it.
So, in my "ThisWorkbook" my code looks like:
Code:
Private Sub workbook_Open()
Call StartBlink
End Sub
Code:
Sub StartBlink()
Dim xCell As Range
Dim xTime As Variant
Set xCell = ThisWorkbook.Worksheets("VOC -1").Range("M5")
With ThisWorkbook.Worksheets("VOC -1").Range("M5").Font
If xCell.Font.Color = vbRed Then
xCell.Font.Color = vbWhite
Else
xCell.Font.Color = vbRed
End If
End With
xTime = Now + TimeSerial(0, 0, 0.75)
Application.OnTime xTime, "'" & ThisWorkbook.Name & "'!StartBlink", , True
End Sub
How do I make it stop when I close the file?
Thanks,
Fi
Last edited by a moderator: