AW: zweite Zeile löschen
07.03.2007 09:43:15
Erich
Hallo Erich,
probier mal diese beiden Prozeduren:
Option Explicit
Sub Zeilen_löschen4()
Dim rng As Range, lngZ As Long, lngA As Long, lngL As Long, zz As Long
Set rng = Cells.Find("*", Cells(1, 1), xlValues, , xlByRows, xlPrevious)
If rng Is Nothing Then lngZ = 1 Else lngZ = rng.Row
lngA = ActiveCell.Row
lngL = InputBox("Wie viele Zeilen maximal sollen gelöscht werden?", "ZEILE LÖSCHEN", "10")
Application.ScreenUpdating = False
For zz = Application.Min(lngA - 1 + 2 * lngL, lngZ - lngA Mod 2) To lngA + 1 Step -2
Rows(zz).Delete
Next zz
Application.ScreenUpdating = True
End Sub
Sub Zeilen_löschen3()
Dim rng As Range, lngZ As Long, zz As Long
Set rng = Cells.Find("*", Cells(1, 1), xlValues, , xlByRows, xlPrevious)
If rng Is Nothing Then lngZ = 1 Else lngZ = rng.Row
Application.ScreenUpdating = False
For zz = lngZ - ActiveCell.Row Mod 2 To ActiveCell.Row + 1 Step -2
Rows(zz).Delete
Next zz
Application.ScreenUpdating = True
End Sub
Die erste fragt nach der Anzahl zu löschender Zeilen, die zweite löscht bis zum Ende der Tabelle.
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort