Friday, February 24, 2012

Make a Cell Range Flash Different Colors

Dim iCount As Integer

Sub ColorChange()

Dim dTime As Date

''''''''''''''''''''''''''''''

'Will make range of cells, or single cell change colors _

 at 2 second intervals

''''''''''''''''''''''''''''''

 dTime = Now

 Application.OnTime dTime + TimeValue("00:00:02"), "ColorChange"

 iCount = iCount + 1

 Range("C3:G13").Interior.ColorIndex = Choose(iCount, 3, 36, 50, 7, 34)

   If iCount = 5 Then

    iCount = 0

    Application.OnTime dTime + TimeValue("00:00:02"), "ColorChange", , False

   End If

End Sub

No comments:

Post a Comment