Hello Gurus,
Attached is a snippet of data I use daily.
I need to delete the row that contains a cell with a value of LESS THAN 1... but it must also keep the rows containing blank cells...
Any ideas?
Hello Gurus,
Attached is a snippet of data I use daily.
I need to delete the row that contains a cell with a value of LESS THAN 1... but it must also keep the rows containing blank cells...
Any ideas?
Hi InkyDrinky,
Try this:
![]()
Sub DelLT1() Dim LastRow As Double Dim RowCtr As Double LastRow = Cells(Rows.Count, "A").End(xlUp).Row For RowCtr = LastRow To 1 Step -1 If Cells(RowCtr, "A").Value < 1 And Cells(RowCtr, "A") <> "" Then Cells(RowCtr, "A").EntireRow.Delete End If Next RowCtr End Sub
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
Thank you soo much!
An alternative method would be to use autofilter. If have a high number of rows it will be a bit faster than looping.
Alf![]()
Sub DelRows() ActiveSheet.AutoFilterMode = False ActiveSheet.UsedRange.AutoFilter Field:=1, Criteria1:="<1" ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).EntireRow.Delete ActiveSheet.AutoFilterMode = False End Sub
Last edited by Alf; 11-14-2016 at 03:37 AM. Reason: Corrected wrong line in macro
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks