Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 4
Default Count After Filter in macro

I'm trying to count visible number of cells in a specific column after auto filter in macro. Here's the code I'm trying. I get 389 as the final answer, whereas the visible cells are only 7. othdet1 is a range and othdet is an integer.


Set othdet1 = Sheets("OTHERS").Range("I4:I400")

othdet = Range("i4:i400").SpecialCells(xlCellTypeVisible).C ount

Sheets("OTHERS").Range("N4") = othdet

The range I4:i400 is a result of an auto filter from parent sheet.

where am I going wrong?
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Count After Filter in macro

Hi,

Am Tue, 2 Jul 2013 16:09:15 +0100 schrieb cvhar87:

I'm trying to count visible number of cells in a specific column after
auto filter in macro. Here's the code I'm trying. I get 389 as the final
answer, whereas the visible cells are only 7. othdet1 is a range and
othdet is an integer.


try:
Set othdet1 = Sheets("OTHERS").Range("I4:I400")

othdet = WorksheetFunction.Subtotal(3, othdet1)

Sheets("OTHERS").Range("N4") = othdet


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Junior Member
 
Posts: 4
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Tue, 2 Jul 2013 16:09:15 +0100 schrieb cvhar87:

I'm trying to count visible number of cells in a specific column after
auto filter in macro. Here's the code I'm trying. I get 389 as the final
answer, whereas the visible cells are only 7. othdet1 is a range and
othdet is an integer.


try:
Set othdet1 = Sheets("OTHERS").Range("I4:I400")

othdet = WorksheetFunction.Subtotal(3, othdet1)

Sheets("OTHERS").Range("N4") = othdet


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Thank you again Claus!.

Say if i Want to Count occurrences of only YES , in the filtered results in column I4:I400? How do i go about it?

The range will have blanks and NO apart from YES.
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
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Programming 0 May 3rd 08 01:03 AM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM


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