zoom38
02-05-2008, 08:07 PM
Hello all,
I have the following blink procedure. I would like to limit the blinking to a set amount of time, say 30 seconds. How do I call "StopBlink" 30 seconds after "StartBlink" begins? Does anyone know how I might do that?
Sub StartBlink()
Dim r As Integer
Dim x As Long
sheets(3).Select
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
r = 3
For x = 3 To LastRow
If Cells(r, 15).Value = "1st Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "2nd Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "3rd Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "4th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "5th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "6th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "7th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "8th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "9th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
End If
r = r + 1
Next x
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
sheets(3).Range("O3:O" & LastRow).Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink", , False '
End Sub
Thanks
Gary
I have the following blink procedure. I would like to limit the blinking to a set amount of time, say 30 seconds. How do I call "StopBlink" 30 seconds after "StartBlink" begins? Does anyone know how I might do that?
Sub StartBlink()
Dim r As Integer
Dim x As Long
sheets(3).Select
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
r = 3
For x = 3 To LastRow
If Cells(r, 15).Value = "1st Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "2nd Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "3rd Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "4th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "5th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "6th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "7th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "8th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
ElseIf Cells(r, 15).Value = "9th Prize" Then
If Cells(r, 15).Font.ColorIndex = 2 Then
Cells(r, 15).Font.ColorIndex = xlColorIndexAutomatic
ElseIf Cells(r, 15).Font.ColorIndex = xlAutomatic Then
Cells(r, 15).Font.ColorIndex = 2
End If
End If
r = r + 1
Next x
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
sheets(3).Range("O3:O" & LastRow).Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink", , False '
End Sub
Thanks
Gary