'How to delete Rows which don't start with number zero? [closed]
I got a messed up Excel file. In column A should be only unique entries starting with the number 0Ax..... . However, there are some random words in the column which don't belong there. How can I efficiently delete all rows in which the values of column A don't start with 0Ax and so on?
I'd appreciate any help. Thank you.
Solution 1:[1]
Delete Rows Using AutoFilter
Option Explicit
Sub deleteRows()
With ThisWorkbook.Worksheets("Sheet1").Range("A1").CurrentRegion
Application.ScreenUpdating = False
.Worksheet.AutoFilterMode = False
.AutoFilter Field:=1, Criteria1:="<>0Ax*"
With .Resize(.Rows.Count - 1, 1).Offset(1)
On Error Resume Next
.SpecialCells(xlCellTypeVisible).EntireRow.Delete
On Error GoTo 0
End With
.Worksheet.AutoFilterMode = False
Application.ScreenUpdating = True
End With
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VBasic2008 |
