Gruppe
Ereignis
Problem
Wie kann ich die Hintergrundfarbe einer Zelle jede Sekunde wechseln?
ClassModule: DieseArbeitsmappe
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call BlinkenEnde
End Sub
StandardModule: basMain
Public Const giIntervall As Integer = 1
Public Const gsMacro As String = "Blinken"
Public gdNextTime As Double
Sub BlinkenEin()
gdNextTime = Now + TimeSerial(0, 0, giIntervall)
Application.OnTime earliesttime:=gdNextTime, _
procedure:=gsMacro, schedule:=True
End Sub
Private Sub Blinken()
With ActiveCell
If .Interior.ColorIndex = 6 Then
.Interior.ColorIndex = 9
.Font.ColorIndex = 6
Else
.Interior.ColorIndex = 6
.Font.ColorIndex = 9
End If
End With
Call BlinkenEin
End Sub
Sub BlinkenEnde()
On Error Resume Next
Application.OnTime earliesttime:=gdNextTime, _
procedure:=gsMacro, schedule:=False
End Sub