Du brauchst nur ein DIM
11.05.2011 11:13:43
Matthias
Hallo
Dim iZeile As Long
With Sheets("Ampel")
.Visible = True
.Select
For iZeile = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If IsDate(.Cells(iZeile, 1)) Then .Cells(iZeile, 1).EntireRow.Delete: Exit For
Next iZeile
MsgBox "weiter" 'nur zum verfolgen
.Visible = False
End With
With Sheets("Daten")
.Visible = True
.Select
For iZeile = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If IsDate(.Cells(iZeile, 1)) Then .Cells(iZeile, 1).EntireRow.Delete: Exit For
Next iZeile
MsgBox "weiter" 'nur zum verfolgen
.Visible = False
End With
wobei das so schon reicht - ohne Visible & ohne Select
Option Explicit
Sub ml()
Dim iZeile As Long
With Sheets("Ampel")
For iZeile = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If IsDate(.Cells(iZeile, 1)) Then .Cells(iZeile, 1).EntireRow.Delete: Exit For
Next iZeile
End With
With Sheets("Daten")
For iZeile = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If IsDate(.Cells(iZeile, 1)) Then .Cells(iZeile, 1).EntireRow.Delete: Exit For
Next iZeile
End With
End Sub