Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default return row count of filtered data.


I want to be able to count the amount of rows returned after i filter
some data. If the row count1, eg atleast one row returned then i want
the script to execute some code

When i pause my macro, i can see 11 rows are selected, and those 11
rows are copied to the new sheet but the row count returned is too
large.


Code:
--------------------

Sheets("List").Select
Selection.AutoFilter Field:=7, Criteria1:="=" & Range("I1").Value ' Filter data. (Rows returned are 11)
Set NewIssueRC = ActiveSheet.AutoFilter.Range
NewIssueRC.Copy 'Copy Filtered Data. 11 rows are selected
Count = ActiveSheet.AutoFilter.Range.Count ' DOSNT WORK. Returns 3441 rows of data.

If Count 0 Then
Application.StatusBar = "CREATING NEW ISSUES PIVOT TABLE......."
........
........

--------------------


--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520955

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default return row count of filtered data.

You could use the worksheet subtotal function to count the number of values
in the filtered list, set the 'myRange' for the total un-filtered range
first e.g........


' the unfiltered list range extent
Set myRange = Range("A4:A1000")

' get the filtered list count
Count = Application.WorksheetFunction.Subtotal(3, myRange)

--
Cheers
Nigel



"tarns" wrote in
message ...

I want to be able to count the amount of rows returned after i filter
some data. If the row count1, eg atleast one row returned then i want
the script to execute some code

When i pause my macro, i can see 11 rows are selected, and those 11
rows are copied to the new sheet but the row count returned is too
large.


Code:
--------------------

Sheets("List").Select
Selection.AutoFilter Field:=7, Criteria1:="=" & Range("I1").Value '

Filter data. (Rows returned are 11)
Set NewIssueRC = ActiveSheet.AutoFilter.Range
NewIssueRC.Copy 'Copy

Filtered Data. 11 rows are selected
Count = ActiveSheet.AutoFilter.Range.Count ' DOSNT WORK.

Returns 3441 rows of data.

If Count 0 Then
Application.StatusBar = "CREATING NEW ISSUES PIVOT TABLE......."
........
........

--------------------


--
tarns
------------------------------------------------------------------------
tarns's Profile:

http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520955



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default return row count of filtered data.


Thanks bro, also got it with

NewIssueCount =
ActiveSheet.AutoFilter.Range.Columns(1).SpecialCel ls(xlVisible).Count -
1


--
tarns
------------------------------------------------------------------------
tarns's Profile: http://www.excelforum.com/member.php...o&userid=32291
View this thread: http://www.excelforum.com/showthread...hreadid=520955

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
Count all except filtered data andy62 Excel Discussion (Misc queries) 2 May 12th 09 07:43 PM
Return filtered values into report worksheet based on filtered valueon the data worksheet dicko1 Excel Worksheet Functions 1 April 21st 09 12:27 AM
count filtered data ccravens Excel Discussion (Misc queries) 1 March 23rd 07 12:08 AM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM
Count filtered data only paulharvey[_3_] Excel Programming 1 July 18th 05 06:26 PM


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