locate positive numbers and delete rows containing

G

Giggly4g

I'm trying to isolate negative balances in a very large wookbook. Is there a
way to easily locate the positive balances and delete the rows containing
them (leaving only the negative balances)? I've tried to mark with
conditional formatting for >0 but the column titles get marked, too. Any
assistance would be greatly appreciated.
 
F

Fred Smith

Your best bet would be filtering. Use Data>Filter>Advanced Filter records
greater than zero. Now you have all the positive rows displayed, and you can
delete them all. Turn off the filter and you're left with only the negative
records.

Note that it will take a while to delete the filtered records if you have a
lot of them.

Regards,
Fred.
 
M

Mike

Sub deleterows()
Const columnBalance = "A"
Dim rngBalance As Range
Dim i As Long

Set rngBalance = Range(Cells(1, columnBalance), _
Cells(Rows.Count, columnBalance).End(xlUp))
'Work backwards from bottom to top when deleting rows
Application.ScreenUpdating = False
With rngBalance
For i = .Rows.Count To 1 Step -1
If .Cells(i) < 0 Then
.Cells(i).EntireRow.Delete
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
 
G

Giggly4g

Absolutely fabulous. A few little tweaks and it works perfectly. Thank you so
much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top