Macro needed to identify value and delete row if value below targe

  • Thread starter Thread starter Pyrotoy
  • Start date Start date
P

Pyrotoy

I need a macro that will locate a numeric value in column J only, and if that
value is less than 15, the entire row on which that value is located will be
deleted. Thank you.
 
Give this macro a try...

Sub RemoveRowsLessThan15()
Dim X As Long
With Worksheets("Sheet1")
For X = .UsedRange.Rows.Count To 1 Step -1
If IsNumeric(.Cells(X, "J").Value) Then
If .Cells(X, "J").Value < 15 Then .Rows(X).Delete
End If
Next
End With
End Sub
 
Sub killsmall()
n = Cells(Rows.Count, "J").End(xlUp).Row
For j = n To 1 Step -1
If Cells(j, "J").Value < 15 Then
Cells(j, "J").EntireRow.Delete
End If
Next
End Sub
 
Back
Top