[Solved] Macro to delete rows if cell begins with specific number


For Column A (excluding first row for header)…

Option Explicit

Sub Delete_3_4()

Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sheet1")

Dim SearchRange As Range, SearchCell As Range, DeleteMe As Range
Set SearchRange = ws.Range("A2:A" & ws.Range("A" & ws.Rows.Count).End(xlUp).Row)

For Each SearchCell In SearchRange
    If Left(SearchCell, 1) = 3 Or Left(SearchCell, 1) = 4 Then
        If DeleteMe Is Nothing Then
            Set DeleteMe = SearchCell
        Else
            Set DeleteMe = Union(DeleteMe, SearchCell)
        End If
    End If
Next SearchCell

If Not DeleteMe Is Nothing Then DeleteMe.EntireRow.Delete

End Sub

2

solved Macro to delete rows if cell begins with specific number