Hallo Hajo
Herzlichen Dank für Deine Unterstützung.
Im Anschluß mein Ergebniss zum Testen
Makro 1 zum füllen einer Beispieltabelle.
Sub Makro1()
'
' Makro1 Makro
'
Range("A1").Select
ActiveCell.FormulaR1C1 = "Datum"
Range("A2").Select
ActiveCell.FormulaR1C1 = "2/2/2008"
Range("A3").Select
ActiveCell.FormulaR1C1 = "3/3/2009"
Range("A4").Select
ActiveCell.FormulaR1C1 = "4/4/2010"
Range("A5").Select
End Sub
Makro "Löschen" das Ergebnis
Sub löschen()
' Alle Zeilen ausser Datum Jahr zb. 2009 und Kopfzeile Datum
Dim LoI As Long
Dim LoLetzte As Long
Dim variable As String
' letzte Zelle in Spalte A
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 1)), Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count)
On Error Resume Next
variable = InputBox("Jahr:", , "2009")
For LoI = LoLetzte To 1 Step -1
'Kopfzeilenabfrage
If Year(CDate(Cells(LoI, 1))) = Datum Then Exit Sub
'Jahreszahl Kontrolle
If Year(CDate(Cells(LoI, 1))) <> variable Then Rows(LoI).Delete
Next
On Error GoTo 0
End Sub
Übrig bleibt nur die Kopfzeile und die Zeile mit Datum xxxx2009.
MfG
Wetterigel