Sub test()
Dim LR As Long
Application.ScreenUpdating = False
LR = ActiveSheet.Range("O" & Rows.Count).End(xlUp).Row
For r = LR To 2 Step -1
If (Range("O" & r).Value <> "Mdn") Then
Rows(r).Delete
Application.ScreenUpdating = True
End If
Next r
End Sub
Sub DeleteUnwanted()
Const TextToKeep As String = "Mdn" '<-- Change to suit
Application.ScreenUpdating = False
With Range("O1", Range("O" & Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="<>" & TextToKeep
.Offset(1).EntireRow.Delete
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub
Sub delmdn()
Application.ScreenUpdating = False
lr = Cells(Rows.Count, "O").End(xlUp).Row
For i = lr To 2 Step -1
For x = 1 To 15
If Cells(i, x).Text = "Mdn" Then
Exit For
End If
If x = 15 And Cells(i, x).Text <> "mdn" Then Cells(i, x).EntireRow.Delete
Next
Next
Application.ScreenUpdating = True
End Sub
Try this.. supposed your last data is in column O
Rich (BB code):Sub delmdn() Application.ScreenUpdating = False lr = Cells(Rows.Count, "O").End(xlUp).Row For i = lr To 2 Step -1 For x = 1 To 15 If Cells(i, x).Text = "Mdn" Then Exit For End If If x = 15 And Cells(i, x).Text <> "mdn" Then Cells(i, x).EntireRow.Delete Next Next Application.ScreenUpdating = True End Sub
Sub delmdn()
Application.ScreenUpdating = False
lr = Cells(Rows.Count, "O").End(xlUp).Row
For i = lr To 2 Step -1
For x = 1 To 15
If Cells(i, x).Text = "Mdn" Then
Exit For
End If
If x = 15 And Cells(i, x).Text <> "Mdn" Then Cells(i, x).EntireRow.Delete
Next
Next
Application.ScreenUpdating = True
End Sub