Thread: Flashing cells
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Robert Martim, Excel Robert Martim, Excel is offline
external usenet poster
 
Posts: 20
Default Flashing cells

Max

You can do as follows.

In ThisWorkbook module, add:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub

Private Sub Workbook_Open()
startFlashing
End Sub

In a module, add:

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

Change the code as required for your purpose.

--
Robert
Author of RibbonX: Customizing the Office 2007 Ribbon:
FOR THE LATEST TUTORIALS VISIT:
http://www.msofficegurus.com


"MAX" wrote:

I need a code to flashing 4 cells in a workbook of 3 sheets.
1. Sheet 1 (Cell A1)
2. Sheet 2 (Cell B1) and
3. Sheet 3 (Cells C1 and C2).
If possible when I open the workbook, I find these 4 cells flashing without
the need of run macro.

Thank you for your help Masters.