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 Range problem

Hi all,

I have the following code on deleting rows using autofilter. However,
strange problem appears.

I have no idea on that. :(

Any help would be grateful.
Thanks.

Range that will be deleted:
-------------
$Q$73:$Q$77
$Q$2:$Q$3
$1:$1,$309:$65536


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 Is Nothing An
Round(Application.WorksheetFunction.Sum(rng2), 0) = 0 Then
Debug.Print rng2.Address
Application.WorksheetFunction.Sum (rng2) & "
& Round(Application.WorksheetFunction.Sum(rng2), 0)
rng2.EntireRow.Delete
End If
End With
Next i
Next

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Autofilter with Range problem

what is the strange problem that appears?
-----Original Message-----
Hi all,

I have the following code on deleting rows using

autofilter. However, a
strange problem appears.

I have no idea on that. :(

Any help would be grateful.
Thanks.

Range that will be deleted:
-------------
$Q$73:$Q$77
$Q$2:$Q$3
$1:$1,$309:$65536


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 Is Nothing And
Round(Application.WorksheetFunction.Sum(rng2), 0) = 0 Then
Debug.Print rng2.Address
Application.WorksheetFunction.Sum (rng2) & " "
& Round(Application.WorksheetFunction.Sum(rng2), 0)
rng2.EntireRow.Delete
End If
End With
Next i
Next h


---
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
What is Range For Chart AutoFilter Range VBA? [email protected] Excel Discussion (Misc queries) 0 April 19th 06 05:30 PM
Problem with Autofilter Jaan Excel Discussion (Misc queries) 6 February 8th 06 06:39 AM
Autofilter problem Jake Excel Worksheet Functions 1 July 5th 05 12:12 PM
autofilter problem emre Excel Worksheet Functions 0 March 29th 05 10:19 PM
Now problem with autofilter James Stephens Excel Programming 3 January 14th 04 07:50 PM


All times are GMT +1. The time now is 12:46 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"