ist es möglich dass man die Farbe des Comman Button durch eine Abfrage wechseln lässt ?
Wenn in Spalte A ein Datum dieser Woche wäre sollte der Button Rot werden.
Danke für die Hilfe :)
Dim lngDatum As Long
Dim intZaehler As Integer
Dim datMontag As Date
datMontag = Date - Application.Weekday(Date, 2) + 1
For intZaehler = 0 To 6
lngDatum = Application.CountIf(Worksheets("Tabelle1").Columns(1), _
datMontag + intZaehler)
If lngDatum > 0 Then Exit For
Next intZaehler
If lngDatum > 0 Then
Worksheets("Tabelle1").CommandButton1.BackColor = &HFF&
Else
Worksheets("Tabelle1").CommandButton1.BackColor = &H8000000F
End If
Dim lngDatum As Long
Dim intZaehler As Integer
Dim datMontag As Date
Dim arrFarbe(1)
Dim f As Boolean
Dim t As Double
Const Pause = 0.5
arrFarbe(0) = &HFF&
arrFarbe(1) = &H8000000F
datMontag = Date - Application.Weekday(Date, 2) + 1
For intZaehler = 0 To 6
lngDatum = Application.CountIf(Worksheets("Tabelle1").Columns(1), _
datMontag + intZaehler)
If lngDatum > 0 Then Exit For
Next intZaehler
intZaehler = 0
If lngDatum > 0 Then
Do
f = Not f
Worksheets("Tabelle1").CommandButton1.BackColor = arrFarbe(-f)
t = Timer + Pause
Do While Timer
Private Sub PruefeDatum()
Dim Rx As Range
Set Rx = Columns("A").Find(Date)
If Not Rx Is Nothing Then
CommandButton1.BackColor = &HFF&
Else
CommandButton1.BackColor = &H8000000F
End If
End Sub
Gruß Armin