Sub Schaltfläche2_BeiKlick()
'Nächstes datum in A Suchen
Dim Datum As Date, wks As Worksheet, bolFound As Boolean
Set wks = ActiveSheet
With wks
Datum = .Cells(5, 3).Value
bolFound = False
For lngzeile = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(lngzeile, 1).Value = Datum Then
If lngzeile = .Cells(.Rows.Count, 1).End(xlUp).Row Then
Exit For
Else
.Cells(5, 3).Value = .Cells(lngzeile + 1, 1).Value
bolFound = True
Exit For
End If
End If
Next
If bolFound = False Then
MsgBox "Nächstes Datum ausserhalb Auswahlliste!"
End If
End With
End Sub
'Die einfache Variante.
Sub Schaltfläche2_BeiKlick()
'Nächstes datum in A Suchen
.Cells(5, 3).Value = .Cells(5, 3).Value + 1
End Sub