Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Kevin Jenkins   on Sep 05 In MS Office Category.

  
Question Answered By: Gerald Cruz   on Sep 05

One way:
1. Put this in the Thisworkbook code module:

Private Sub Workbook_Open()
blink
End Sub

2. then this line at the top of a standard code module:

Dim flipflop As Boolean

3. then this below any other code in the module:

Sub blink()
If Range("A1") = "x" Then Exit Sub
NameExists = False
For Each n In ThisWorkbook.Names
If UCase(n.Name) = "AAACELLS" Then
NameExists = True
Exit For
End If
Next n
If NameExists Then
Application.OnTime Now + TimeValue("00:00:01"), "blink"
flipflop = Not flipflop
If flipflop Then
Range("aaacells").Interior.ColorIndex = 3
Else
Range("aaacells").Interior.ColorIndex = 6
End If
End If
End Sub


4. Define a name called "aaacells" being the cell/s, contiguous or
not, that you want to have blink.

5. Save and close the workbook. Open it.

Notes:

The blink macro calls itself at about 1 second intervals due to the
line:
Application.OnTime Now + TimeValue("00:00:01"), "blink"
Adjust as required.

The line:
If Range("A1") = "x" Then Exit Sub
should be commented out or deleted - it was just there to stop the
loop while debugging (by putting an 'x' into cell A1 of the active
sheet).

The name 'aaacells' should exist in the workbook somewhere otherwise
it won't blink. (I used a name with 'aaa' at the beginning so that the
loop which checks for the existence of the name exits early - for the
most part of no consequence unless you have hundreds of defined names
in the workbook.)

You can start the blinking manually by running the macro.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to animate cells in Excel Or get search suggestion and latest updates.


Tagged: