Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Testing for hidden rows

Excel 2002, WinXP
I have a range of rows, say Rows("1:10").
These rows may ALL be hidden or none be hidden or some be hidden.
I need to check, via VBA, if ALL the rows are hidden.
The statement:
If Rows("5:10").EntireRow.Hidden Then
returns True if any one or more of the rows are hidden.
I need to know if they are ALL hidden or not.
The number of rows is fixed so I can count the number of hidden rows, if I
knew how.
How can I determine if ALL the rows are hidden?
Thanks for your help. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Testing for hidden rows

Otto,

Sub TryNow()
Dim i As Integer

For i = 1 To 10
If Not Rows(i).Hidden Then
MsgBox "Not all rows are Hidden."
Exit Sub
End If
Next i

MsgBox "All rows are Hidden."

End Sub

HTH,
Bernie
MS Excel MVP

"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a range of rows, say Rows("1:10").
These rows may ALL be hidden or none be hidden or some be hidden.
I need to check, via VBA, if ALL the rows are hidden.
The statement:
If Rows("5:10").EntireRow.Hidden Then
returns True if any one or more of the rows are hidden.
I need to know if they are ALL hidden or not.
The number of rows is fixed so I can count the number of hidden rows, if I
knew how.
How can I determine if ALL the rows are hidden?
Thanks for your help. Otto




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Testing for hidden rows

Thanks Bernie, I was afraid it would take a row-by-row check like that.
Otto
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Otto,

Sub TryNow()
Dim i As Integer

For i = 1 To 10
If Not Rows(i).Hidden Then
MsgBox "Not all rows are Hidden."
Exit Sub
End If
Next i

MsgBox "All rows are Hidden."

End Sub

HTH,
Bernie
MS Excel MVP

"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a range of rows, say Rows("1:10").
These rows may ALL be hidden or none be hidden or some be hidden.
I need to check, via VBA, if ALL the rows are hidden.
The statement:
If Rows("5:10").EntireRow.Hidden Then
returns True if any one or more of the rows are hidden.
I need to know if they are ALL hidden or not.
The number of rows is fixed so I can count the number of hidden rows, if

I
knew how.
How can I determine if ALL the rows are hidden?
Thanks for your help. Otto






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Testing for hidden rows

Otto,

You don't _have_ to do it row by row. You can use the error produced by
looking for visiblecells when all rows are hidden:


Dim i As Integer
On Error GoTo AllHidden
i = Range("1:10").SpecialCells(xlCellTypeVisible).Coun t
MsgBox "Some or all rows weren't hidden"
Exit Sub
AllHidden:
MsgBox "All rows were hidden"

HTH,
Bernie
MS Excel MVP

"Otto Moehrbach" wrote in message
...
Thanks Bernie, I was afraid it would take a row-by-row check like that.
Otto
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Otto,

Sub TryNow()
Dim i As Integer

For i = 1 To 10
If Not Rows(i).Hidden Then
MsgBox "Not all rows are Hidden."
Exit Sub
End If
Next i

MsgBox "All rows are Hidden."

End Sub

HTH,
Bernie
MS Excel MVP

"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a range of rows, say Rows("1:10").
These rows may ALL be hidden or none be hidden or some be hidden.
I need to check, via VBA, if ALL the rows are hidden.
The statement:
If Rows("5:10").EntireRow.Hidden Then
returns True if any one or more of the rows are hidden.
I need to know if they are ALL hidden or not.
The number of rows is fixed so I can count the number of hidden rows,

if
I
knew how.
How can I determine if ALL the rows are hidden?
Thanks for your help. Otto








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
opening a group but keep hidden rows hidden MWL Excel Discussion (Misc queries) 0 February 17th 09 03:16 PM
Hidden rows columns won't stay hidden christie Excel Worksheet Functions 0 September 30th 08 05:44 PM
Formula or Code to keep Hidden Rows Hidden Carol Excel Worksheet Functions 6 May 1st 07 11:45 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 03:14 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"