Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count remaining rows after autofilter has been applied


Hi,

I need to be able to count the number of cells that I highlight with
the cursor in a column.

For Example: I have a spreadsheet with 1000 records.

I will need to run autofilter to retrict my rows.

Then I need to be able to count the number of rows that are *remaining
*after the autofilter has been applied.

If I could highlight the remaining rows with the curser and then run a
macro to count the number of rows that I have highlighted?? Any
thoughts?

This is urgent so any help would be great!

Thanks!


--
walshy06
------------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...o&userid=34132
View this thread: http://www.excelforum.com/showthread...hreadid=539012

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Count remaining rows after autofilter has been applied

Dim rng as Range
set rng = ActiveSheet.Autofilter.Range.Columns(1).specialCel ls(xlVisible)

msgbox rng.Count - 1 & " data rows are visible"

--
Regards,
Tom Ogilvy


"walshy06" wrote:


Hi,

I need to be able to count the number of cells that I highlight with
the cursor in a column.

For Example: I have a spreadsheet with 1000 records.

I will need to run autofilter to retrict my rows.

Then I need to be able to count the number of rows that are *remaining
*after the autofilter has been applied.

If I could highlight the remaining rows with the curser and then run a
macro to count the number of rows that I have highlighted?? Any
thoughts?

This is urgent so any help would be great!

Thanks!


--
walshy06
------------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...o&userid=34132
View this thread: http://www.excelforum.com/showthread...hreadid=539012


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count remaining rows after autofilter has been applied


Thanks for your help,


I'm getting a compile error when I run the code?


Sub count_rows()

Dim rng As Range

set rng = sheet1.Autofilter.Range.Columns(1).specialCel ls(xlVisible)

MsgBox rng.Count - 1 & " data rows are visible"

End Sub



Any idea what changes I need to make?

Thanks again

--
walshy0
-----------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...fo&userid=3413
View this thread: http://www.excelforum.com/showthread.php?threadid=53901

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count remaining rows after autofilter has been applied

Looks like you misspelled "specialcells"

There is no space between the "L's" in "cells"

I copied the code from my original post, put it in a module (with a sub) and
ran it on a sheet with an autofilter applied and it ran like a champ.

That said, sometimes when you copy stuff from Google, it inserts stray
characters - so maybe you were a victim of that.

--
Regards,
Tom Ogilvy


"walshy06" wrote in
message ...

Thanks for your help,


I'm getting a compile error when I run the code?


Sub count_rows()

Dim rng As Range

set rng = sheet1.Autofilter.Range.Columns(1).specialCel ls(xlVisible)

MsgBox rng.Count - 1 & " data rows are visible"

End Sub



Any idea what changes I need to make?

Thanks again!


--
walshy06
------------------------------------------------------------------------
walshy06's Profile:

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count remaining rows after autofilter has been applied


Thanks for your help, That works perfectly!

--
walshy0
-----------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...fo&userid=3413
View this thread: http://www.excelforum.com/showthread.php?threadid=53901



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Count remaining rows after autofilter has been applied

Tom, I am trying to run this code in Excel 2k and I get a run-time error 91
"Object variable or With block variable not set". With so little code, why is
this not working? Thanks in advance for your assistance. GDCROSS

"Tom Ogilvy" wrote:

Dim rng as Range
set rng = ActiveSheet.Autofilter.Range.Columns(1).specialCel ls(xlVisible)

msgbox rng.Count - 1 & " data rows are visible"

--
Regards,
Tom Ogilvy


"walshy06" wrote:


Hi,

I need to be able to count the number of cells that I highlight with
the cursor in a column.

For Example: I have a spreadsheet with 1000 records.

I will need to run autofilter to retrict my rows.

Then I need to be able to count the number of rows that are *remaining
*after the autofilter has been applied.

If I could highlight the remaining rows with the curser and then run a
macro to count the number of rows that I have highlighted?? Any
thoughts?

This is urgent so any help would be great!

Thanks!


--
walshy06
------------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...o&userid=34132
View this thread: http://www.excelforum.com/showthread...hreadid=539012


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Count remaining rows after autofilter has been applied

You haven't applied data|filter|autofilter to your worksheet -- look for those
dropdown arrows and you'll see that they aren't there.

GDCross wrote:

Tom, I am trying to run this code in Excel 2k and I get a run-time error 91
"Object variable or With block variable not set". With so little code, why is
this not working? Thanks in advance for your assistance. GDCROSS

"Tom Ogilvy" wrote:

Dim rng as Range
set rng = ActiveSheet.Autofilter.Range.Columns(1).specialCel ls(xlVisible)

msgbox rng.Count - 1 & " data rows are visible"

--
Regards,
Tom Ogilvy


"walshy06" wrote:


Hi,

I need to be able to count the number of cells that I highlight with
the cursor in a column.

For Example: I have a spreadsheet with 1000 records.

I will need to run autofilter to retrict my rows.

Then I need to be able to count the number of rows that are *remaining
*after the autofilter has been applied.

If I could highlight the remaining rows with the curser and then run a
macro to count the number of rows that I have highlighted?? Any
thoughts?

This is urgent so any help would be great!

Thanks!


--
walshy06
------------------------------------------------------------------------
walshy06's Profile: http://www.excelforum.com/member.php...o&userid=34132
View this thread: http://www.excelforum.com/showthread...hreadid=539012



--

Dave Peterson
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
How do I count rows in a filtered list when using AutoFilter? chiefcook Excel Worksheet Functions 6 November 10th 08 09:21 AM
how to write macro after autofilter is applied emre Excel Worksheet Functions 2 March 31st 05 02:59 PM
how to autofilter for the remaining values???? monica Excel Programming 1 September 9th 04 12:22 PM
Finding row count and filtered rows returned by Autofilter Joseph Uher Excel Programming 0 September 20th 03 08:49 PM
How To Count Rows Displayed After Applying AutoFilter Steve[_32_] Excel Programming 2 August 12th 03 02:45 PM


All times are GMT +1. The time now is 12:24 AM.

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

About Us

"It's about Microsoft Excel"