Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Question RE Count of records in AutoFilter

Why is it that I'm having to use the separate Else statement "Count -2" when
my
I'm back to selecting "All" from my Auto-Filter range?

Private Sub CommandButton1_Click()
If FilterMode = True Then
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
Else: MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 2
End If
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Question RE Count of records in AutoFilter


"Jim May" wrote in message
news:zy7hd.1076$ep3.917@lakeread02...
Why is it that I'm having to use the separate Else statement "Count -2"

when
my
I'm back to selecting "All" from my Auto-Filter range?


Is there something missing in the previous paragraph Jim?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Question RE Count of records in AutoFilter

Private Sub CommandButton1_Click()
if activesheet.AutofilterMode then
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
end if
End Sub

worked fine for me.
Check
Activesheet.Autofilter.Range.Address



--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:zy7hd.1076$ep3.917@lakeread02...
Why is it that I'm having to use the separate Else statement "Count -2"

when
my
I'm back to selecting "All" from my Auto-Filter range?

Private Sub CommandButton1_Click()
If FilterMode = True Then
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
Else: MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 2
End If
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Question RE Count of records in AutoFilter

Thanks Tom:
Yeah, not sure why, but when (in the immediate window) I did the
? Autofilter.Range.Address
I got $A$10:$D$21 << where row 21 is in fact blank,,,,
Turned off auto filter - then re-instated,
back to auto filter "on" immediate window again
got $A$10:$D$20; solved!!
realize now I can just use single statement macro

Private Sub CommandButton1_Click()
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
End Sub

Thanks,
Jim May

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_Click()
if activesheet.AutofilterMode then
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
end if
End Sub

worked fine for me.
Check
Activesheet.Autofilter.Range.Address



--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:zy7hd.1076$ep3.917@lakeread02...
Why is it that I'm having to use the separate Else statement "Count -2"

when
my
I'm back to selecting "All" from my Auto-Filter range?

Private Sub CommandButton1_Click()
If FilterMode = True Then
MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 1
Else: MsgBox ActiveSheet.AutoFilter.Range.Columns(1) _
.Cells.SpecialCells(xlCellTypeVisible).Count - 2
End If
End Sub







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 the number of records autofilter is showing in Exce Patricia O''Donnell SSJ Excel Worksheet Functions 3 November 1st 09 09:17 PM
Unique Records Count with AutoFilter Danni2004 Excel Worksheet Functions 1 May 16th 08 09:56 PM
How to obtain the number of filtered records in Autofilter Ramez Excel Worksheet Functions 2 August 24th 06 11:00 PM
Autofilter number of records Ginger Excel Worksheet Functions 3 September 28th 05 03:23 PM
Selecting Filtered records only when AutoFilter is on Owen Vickers Excel Programming 4 February 21st 04 02:20 AM


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