Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default locate positive numbers and delete rows containing

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,389
Default locate positive numbers and delete rows containing

Your best bet would be filtering. Use DataFilterAdvanced 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.

"Giggly4g" wrote in message
...
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.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default locate positive numbers and delete rows containing

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

"Giggly4g" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default locate positive numbers and delete rows containing

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

"Mike" wrote:

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

"Giggly4g" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete all negative numbers leaving only positive numbers Barry Walker Excel Discussion (Misc queries) 9 April 2nd 23 07:34 PM
Excel, change column of negative numbers to positive numbers? Nita New Users to Excel 3 November 27th 07 04:54 AM
How can I delete links (I can't locate) from one file to another? Vin C. Excel Discussion (Misc queries) 1 April 25th 06 09:30 PM
convert negative numbers to positive numbers and vice versa bill gras Excel Worksheet Functions 4 December 7th 05 01:39 AM
Locate and delete specific cells David Smith Excel Discussion (Misc queries) 1 January 19th 05 04:45 PM


All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"