This Procedure will make the range C3:G13 loop through 5 different colors. The changes occur at 2 second intervals. Note the Dim iCount outside the Procedure, this makes it a Module level variable and thus it keeps its value between calls.
Dim iCount As Integer
Sub ColorChange()
Dim dTime As Date
''''''''''''''''''''''''''''''
'Will make range of cells, or single cell change colors _
at 2 second intervals
'Written by OzGrid.com
'''''''''''''''''''''''''''''''
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
No comments:
Post a Comment