user2336288
user2336288

Reputation: 1

Vba Loop to delete rows with numeric value in Cell

I want to delete any row with a numeric value in a cell. When I run the following code it correctly evaluates the IsEmpty and IsNumeric() functions and deletes the row. However it stops for some reason and will complete after 3 tries. Note: I've tried Cell.Value and Cell.Value2.

For Each Cell In Range("H1:H600")
    If Not IsEmpty(Cell) Then
        If IsNumeric(Cell.Value) Then
            Cell.EntireRow.Delete
        End If
    End If
Next

Upvotes: 0

Views: 251

Answers (1)

Tim Williams
Tim Williams

Reputation: 166331

If you don't have formulas in that range:

Range("H1:H600").SpecialCells(xlCellTypeConstants, xlNumbers).EntireRow.Delete

Upvotes: 1

Related Questions