Alex O
Active Member
- Joined
- Mar 16, 2009
- Messages
- 345
- Office Version
- 365
- Platform
- Windows
Can my macro below be edited to hide the target rows insted of deleting them?
Thanks
Sub DeleteUnwantedRows()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "M").End(xlUp).Row
For i = iLastRow To 11 Step -1
If Cells(i, "M").Value <> "117" _
And Cells(i, "M").Value <> "119" _
And Cells(i, "M").Value <> "120" _
And Cells(i, "M").Value <> "121" _
And Cells(i, "M").Value <> "122" _
Then
Rows(i).EntireRow.Delete
End If
Next i
End Sub
Thanks
Sub DeleteUnwantedRows()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "M").End(xlUp).Row
For i = iLastRow To 11 Step -1
If Cells(i, "M").Value <> "117" _
And Cells(i, "M").Value <> "119" _
And Cells(i, "M").Value <> "120" _
And Cells(i, "M").Value <> "121" _
And Cells(i, "M").Value <> "122" _
Then
Rows(i).EntireRow.Delete
End If
Next i
End Sub