Finding values <0.1 in column and deleting rows

chadski778

Active Member
Joined
Mar 14, 2010
Messages
297
Please could you help me. I would like a macro that finds values in column D that equal <0.1 and then deletes the row that they are in?

Thanks
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Code:
Sub Del_Rows()
Dim LR As Long
Dim i As Long

Application.ScreenUpdating = False

With Sheets("Sheet1") 'change sheetname as required
    LR = .Range("D" & Rows.Count).End(xlUp).Row
    
    For i = LR To 1 Step -1
        If .Cells(i, 4) < 0.1 Then .Rows(i).Delete
    Next i
End With

Application.ScreenUpdating = True

End Sub
 
Upvote 0
Here is a macro you can try...

Code:
Sub DeleteRowsLessThanPointOne()
  Dim UnusedColumn As Long, LastRow As Long
  Const StartRow As Long = 2
  Const CheckColumn As Long = 4 'Column D
  LastRow = Cells(Rows.Count, CheckColumn).End(xlUp).Row
  UnusedColumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, _
                 SearchDirection:=xlPrevious, LookIn:=xlFormulas).Column + 1
  With Cells(StartRow, UnusedColumn).Resize(LastRow - StartRow + 1)
    .FormulaR1C1 = "=IF(RC[-" & (UnusedColumn - 4) & "]<0.1,""X"","""")"
    .Value = .Value
    On Error Resume Next
    .SpecialCells(xlCellTypeConstants).EntireRow.Delete
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top