Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofilter with Sum

Hi all,

I have a macro which delete rows with a sum of zero using autofilter
but the marco deletes more than that!
I have no idea on the macro now. :(

Code:
---------------------------------
For h = 1 To arrayH.Count
For i = 1 To arrayQ.Count
ActiveSheet.Range("A1").AutoFilter Field:=cccCol
Criteria1:=arrayQ(i), Operator:=xlAnd
ActiveSheet.Range("A1").AutoFilter Field:=acctCol
Criteria1:=arrayH(h)
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1
1).SpecialCells(xlCellTypeVisible)
Set rng2
rng.Columns(17).SpecialCells(xlCellTypeVisible)
If (Not rng2 = Null) An
(Round(Application.WorksheetFunction.Sum(rng2), 0) = 0) Then
Debug.Print "Delete " & arrayQ(i) & " "
arrayH(h) & " " & _
Application.WorksheetFunction.Sum(rng2) & " "
Round(Application.WorksheetFunction.Sum(rng2), 0)
rng.EntireRow.Delete
End If
End With
Next i
Next h


Result:
---------------------------------
Delete C111 022701 0 0
Delete C286 022701 -179737.193541667 -179737
Delete C302 022701 0 0
Delete C320 022701 268691 268691
Delete C370 022701 -445900 -445900
Delete C600 022701 119197.992268519 119198
Delete C614 022701 1216707.43701389 1216707
Delete C617 022701 0 0
Delete C939 022701 2.1600499167107E-12 0
Delete CB12 022701 0 0
Delete C505 023101 41669.32 41669
Delete C600 023101 80557.6 80558
Delete CB12 023101 0 0
Delete CH09 023101 0 0
Delete CH40 023101 1200 1200
Delete CM77 023101 11158 1115

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofilter with Sum

I got the key to it. :

--
Message posted from http://www.ExcelForum.com

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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . giblon Excel Discussion (Misc queries) 1 February 16th 06 12:23 PM


All times are GMT +1. The time now is 08:44 AM.

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"