Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Determine tje last visible row on the screen.

Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Determine tje last visible row on the screen.

not as far as i know.

"SpeeD" wrote:

Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Determine tje last visible row on the screen.

I dont think there is a direct way..However you could try the below two
methods.

'If all rows are of the same height you can try
Msgbox Fix(Activewindow.Usableheight/rows(1).height)

'If not try the below macro
Sub LastVisibleRow()
Dim lngRow As Long
Do: lngRow = lngRow + 1
Loop Until ActiveWindow.UsableHeight < _
Range("A" & lngRow).Top + Range("A" & lngRow).Height
MsgBox "LastRow displayed on screen is row " & lngRow - 1
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"SpeeD" wrote:

Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Determine tje last visible row on the screen.

As long as you are not near the very bottom of the worksheet (that is, Row
65536 for XL2003, Row 1048576 for XL2007), I think this will work...

With ActiveWindow
.LargeScroll 1
LastVisibleRow = ActiveWindow.ScrollRow - 1
ActiveWindow.LargeScroll , 1
End With

where the bottom displayed row will be place in the LastVisibleRow variable.

--
Rick (MVP - Excel)


"SpeeD" wrote in message
...
Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see
in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Determine tje last visible row on the screen.

I would point out that the major difference between my code and Jacob's
(other than his uses looping and mine does not) appears to be this... my
code returns the row number for the last *fully* visible row (even if there
is part of another row partially visible below it) whereas Jacob's returns
the row number for whatever row is on the bottom of the (visible part of
the) worksheet even if that row is not fully visible.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
As long as you are not near the very bottom of the worksheet (that is, Row
65536 for XL2003, Row 1048576 for XL2007), I think this will work...

With ActiveWindow
.LargeScroll 1
LastVisibleRow = ActiveWindow.ScrollRow - 1
ActiveWindow.LargeScroll , 1
End With

where the bottom displayed row will be place in the LastVisibleRow
variable.

--
Rick (MVP - Excel)


"SpeeD" wrote in message
...
Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see
in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine tje last visible row on the screen.

Rick Rothstein wrote on 09/30/2009 09:19 ET :
As long as you are not near the very bottom of the worksheet (that is, Row
65536 for XL2003, Row 1048576 for XL2007), I think this will work...

With ActiveWindow
.LargeScroll 1
LastVisibleRow = ActiveWindow.ScrollRow - 1
ActiveWindow.LargeScroll , 1
End With

where the bottom displayed row will be place in the LastVisibleRow variable.

Rick (MVP - Excel)


&quot;SpeeD&quot; wrote in message
news:
Hi.

I need to determine the last visible row on the screen.
Im not talking about visible true/false, but the last row a user can see
in
is monitor.
Screen Resolution can change and i really need to know the row.

Can this be done??

Thanks



Hello Rick,

Why don't use that :

LastVisibleRow = ActiveWindow.ActivePane.VisibleRange.Rows.Count +
ActiveWindow.ScrollRow - 1

Thanks
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Determine tje last visible row on the screen.

As long as you are not near the very bottom of the worksheet (that is,
Row
65536 for XL2003, Row 1048576 for XL2007), I think this will work...

With ActiveWindow
.LargeScroll 1
LastVisibleRow = ActiveWindow.ScrollRow - 1
ActiveWindow.LargeScroll , 1
End With

where the bottom displayed row will be place in the LastVisibleRow
variable.


Why don't use that :

LastVisibleRow = ActiveWindow.ActivePane.VisibleRange.Rows.Count +
ActiveWindow.ScrollRow - 1


The reason I didn't do that is because I didn't think of it.<g However, I
am glad you re-activated this thread as we both overlooked something... what
if the Window (Screen) is Split (not Frozen, but Split) and one of the top
Panes is active? In that case, the reported last row will be incorrect. I
think this code will return the correct result no whether the window is
split or not and no matter which Pane is active...

With ActiveWindow
With .Panes(.Panes.Count)
LastVisibleRow = .VisibleRange.Rows.Count + .ScrollRow - 1
End With
End With

Rick Rothstein (MVP - Excel)

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
A way to Determine visible cells on the page Mark Stephens Excel Programming 1 June 2nd 08 05:51 PM
Determine if a PivotField is visible? Whitney Yiu Excel Programming 7 December 22nd 07 06:33 AM
Visible Screen AussieDave Excel Programming 8 September 18th 06 02:42 AM
Determine upper visible corner of sheet John Michl Excel Programming 2 May 4th 06 04:14 PM
Programmatically determine if a control is .VISIBLE or not. Toby Erkson Excel Programming 2 April 16th 04 11:51 PM


All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"