return top and bottom row in window

S

sunilpatel

How can you return the top and bottom row in a window. Also is there a way
to lock and unlock scrolling with mouse wheel

Thanks
 
J

JLGWhiz

For displaying top row and bottom row in a screen, use the split screen
horizontal feature. See help files for deatails.
 
S

Steve Yandl

The subroutine below will return the row numbers of the top and bottom
visible rows in the active Window.

'-----------------------------------------------------

Sub TopAndBottomRow()
Dim lngTopRow As Long
Dim lngBottomRow As Long

With ActiveWindow
lngTopRow = .VisibleRange.Cells(1, 1).Row
lngBottomRow = .VisibleRange.Cells(.VisibleRange.Rows.Count, 1).Row
End With

MsgBox "You can see rows " & lngTopRow & " to " & lngBottomRow

End Sub


'-----------------------------------------------------

Steve Yandl
 
Top