' **********************************************************************
' Modul: DieseArbeitsmappe Typ: Element der Mappe(Sheet, Workbook, ...)
' **********************************************************************
Option Explicit
Private Sub Workbook_Open()
Dim rng As Range, rngC As Range
Dim lngLast As Long
With Tabelle1
lngLast = Application.Max(2, .Cells(.Rows.Count, 2).End(xlUp).Row)
For Each rng In .Range("D3:D" & lngLast)
If IsDate(rng) Then
If rng < Date - 365 Then
If rngC Is Nothing Then
Set rngC = rng.EntireRow
Else
Set rngC = Union(rngC, rng.EntireRow)
End If
End If
End If
Next
End With
With Tabelle2
If Not rngC Is Nothing Then
lngLast = Application.Max(2, .Cells(.Rows.Count, 2).End(xlUp).Row)
rngC.Copy .Cells(lngLast + 1, 1)
rngC.Delete
End If
End With
Set rng = Nothing
Set rngC = Nothing
End Sub
' **********************************************************************
' Modul: DieseArbeitsmappe Typ: Element der Mappe(Sheet, Workbook, ...)
' **********************************************************************
Option Explicit
Private Sub Workbook_Open()
Dim rng As Range, rngC As Range
Dim lngLast As Long
With Tabelle1
lngLast = Application.Max(2, .Cells(.Rows.Count, 2).End(xlUp).Row)
For Each rng In .Range("D3:D" & lngLast)
If IsDate(rng) Then
If rng < Date - 365 Then
If rngC Is Nothing Then
Set rngC = rng.EntireRow
Else
Set rngC = Union(rngC, rng.EntireRow)
End If
End If
End If
Next
End With
With Tabelle2
If Not rngC Is Nothing Then
lngLast = Application.Max(2, .Cells(.Rows.Count, 2).End(xlUp).Row)
rngC.Copy .Cells(lngLast + 1, 1)
rngC.Delete
End If
End With
Set rng = Nothing
Set rngC = Nothing
End Sub