Thread: Flashing cells
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 390
Default Flashing cells

I tried the code below for flashing cells, and it didn't work.
Will you please help me.

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
Range("B1").Interior.ColorIndex = 41
Range("B1").Value = "Light Blue"
ElseIf Range("B1").Interior.ColorIndex = 41 Then
Range("B1").Interior.ColorIndex = 36
Range("B1").Value = "Light Yellow"
End If
End Sub