View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How to test for a Row being Visible on a Spreadsheet

Hi Niall,

You could also try -
rw = 8
bVis = Not ActiveSheet.Rows(rw).EntireRow.Hidden
MsgBox "Row " & rw & " is Visible =" & bVis

However, some rows have been 'frozen' (i.e. by taking Windows /
Unfreeze they re-appear).


So are you really looking for hidden/visible rows, or perhaps instead you
mean rows below the top pane but above the top cell in the bottom pane,
giving the impression of being hidden depending on the vertical scroll in
the bottom pane. If so, start with something like the following -

Dim wn as Window
Set wn = Activewindow
For i = 1 To wn.Panes.Count
With wn.Panes(i).VisibleRange
Debug.Print .Rows(1).Row, .Rows.Count + .Rows(1).Row - 1
End With
Next

Above debugs the top & bottom rows in each pane. Assuming FreezePanese is a
horizontal split only, as confirmed by wn.FreezxePanes = True &
wn.SplitHorizontal = 0, there will be two panes. Any apparently non visible
rows will be those between the bottom row of the top pane and the top row of
the bottom pane.

Of course there may also be 'Hidden' rows in either pane, ie those with a
row height of 0.

Regards,
Peter T







" wrote in message
oups.com...

Hi,

I am a newbie to this group but I have been unable to find a
solution to my problem, so I decided to post it here in the hope that
someone might be able to help.


Issue :

I have a spreadsheet which contains data in rows 6 through 22.
However, some rows have been 'frozen' (i.e. by taking Windows /
Unfreeze they re-appear).
If I look at the sheet, the rows are numbered 5 and then 15. Rows 6
to 14 inclusive are not visible

I am trying to programatically exclude any rows that are not
visible.

I have tried the following lines of code to no avail :

"If Worksheets(strsheetname).Rows(inti).Visible = True Then x = 1 Else
x = 2"

"If Worksheets(strsheetname).Rows(inti).Hidden = True Then x = 1 Else
x = 2"

I also did some trials using the property Visiblerange but once
again, it wasn't coming back as false which would allow me to set the
flag I require.


Thanks in advance for any suggestions,


Niall Heelan