Delete entire row based on cell content

  • Thread starter Thread starter PHIL
  • Start date Start date
P

PHIL

I would like to have a macro run down a column of figures,
deleting rows that contain the number 1. I'm a novice so I
have trouble instructing it to stop when the data ends....

TIA!
 
In a standard module insert:

Sub DeleteRowWith1()
Dim MyRange As Range
Set MyRange = Range("D:D")
For Each c In MyRange
If IsEmpty(ActiveCell.Value) Then
Exit Sub
Else
If c.Value = 1 Then
ActiveCell.EntireRow.Delete
End If
End If
ActiveCell.Offset(1, 0).Select
Next c
End Sub
 
Sub deleterowwithoneinit()
'
' Macro1 Macro
' Macro recorded 3/12/2003 by me
'
For Each c In Worksheets("Sheet1").Range("A:A")
If c.Value = 1 Then
c.EntireRow.Delete
End If
Next

End Sub

Wazza McG
 
Back
Top