In Spalte P habe ich Einträge 1, 2, 3 usw. oder A, B, C usw.
Mit einem Makro will ich alle Zeilen löschen ausgenommen jene mit den Einträgen 1, 2, A und B.
Wie geht das am schnellsten (viele Zeilen).
Vielen Dank
Gregor
Sub neu()
Dim x As Integer
For x = 1 To Cells(Rows.Count, 16).End(xlUp).Row
If Cells(x, 16) = 1 Or Cells(x, 16) = 2 Or Cells(x, 16) = "A" Or Cells(x, 16) = "B" Then
Rows(x).Delete
Else
End If
Next
End Sub
gruß Chris
Sub Löschen_Zeilen()
Dim Prio As Variant
Dim Zeile As Long
Application.ScreenUpdating = False
intLastRow = Cells(Rows.Count, 2).End(xlUp).Row
For Start = 0 To 6
Prio = Array("", 3, 4, 5, 6, "C", "D")
For Zeile = intLastRow To 3 Step -1
If Cells(Zeile, 16).Value = Prio(Start) Then Rows(Zeile).Delete
Next Zeile
Next Start
End Sub
Vermutlich halt jemand eine bessere Lösung.
Gruss
Gregor
Sub Löschen_Zeilen()
Dim Prio As Variant
Dim Zeile As Long
Dim lngLastRow As Long
Application.ScreenUpdating = False
lngLastRow = Cells(Rows.Count, 2).End(xlUp).Row
Prio = Array("", 3, 4, 5, 6, "C", "D")
For Zeile = lngLastRow To 3 Step -1
For Start = 0 To 6
If Cells(Zeile, 16).Value = Prio(Start) Then Rows(Zeile).Delete
Next Start
Next Zeile
End Sub
mfg Hubert