#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Counting Hidden Rows

Is there a way in Excel where I can count rows and columns and get a number
that excludes any hidden rows or columns? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Counting Hidden Rows

In a subroutine/macro?

For a single area range, you can get the number of visible rows/columns with
something like:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myVisibleCell As Range
Set myRng = ActiveSheet.Range("a1:x99")

Set myVisibleCell = Nothing
On Error Resume Next
Set myVisibleCell = myRng.Cells.SpecialCells(xlCellTypeVisible).Cells( 1)
On Error Resume Next

If myVisibleCell Is Nothing Then
MsgBox "0 visible rows and 0 visible columns!"
Else
MsgBox "Visible Rows: " _
& Intersect(myVisibleCell.EntireColumn, myRng) _
.Cells.SpecialCells(xlCellTypeVisible).Cells.Count _
& vbLf & _
"Visible Cols: " _
& Intersect(myVisibleCell.EntireRow, myRng) _
.Cells.SpecialCells(xlCellTypeVisible).Cells.Count
End If
End Sub

Covington wrote:

Is there a way in Excel where I can count rows and columns and get a number
that excludes any hidden rows or columns? Thanks.


--

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
Counting non-blank cells in a column, excluding hidden rows SisterDell Excel Worksheet Functions 3 June 1st 07 03:31 PM
Formula or Code to keep Hidden Rows Hidden Carol Excel Worksheet Functions 6 May 1st 07 11:45 PM
Counting None Hidden Lines dpal Excel Discussion (Misc queries) 1 January 22nd 07 07:30 PM
I need my Hidden Rows to stay hidden when I print the sheet. Rosaliewoo Excel Discussion (Misc queries) 2 July 20th 06 07:51 PM
Excel 2003 -Rows hidden. Scrolling unhides rows ! How do I stop th Excellent1975 Excel Discussion (Misc queries) 0 June 21st 06 08:01 PM


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