Get range of last visible row

mmmreece

New Member
Joined
Apr 8, 2015
Messages
32
Hi. what I'd like to do is find the last visible row... by this I mean the last row that actually shows on the screen whether or not it contains data.... For example... on the spreadsheet I have open at the moment the last visible row with data is 3409 but the last row showing on the screen is 3418..... I'm essentially importing data from a spreadsheet that is open on one computer (computer A) but the data entry is being performed on a network computer (computer B) and updating visibly via one drive... I then have another spreadsheet open on Computer A that the data is imported into ... what I want to do is then move the visible range down one row on the copy of the spreadsheet ( the original not the one it's importing to) down one row so that I can see when the data is updated before performing the import
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Don't know about different screens and that, but this gets the range displayed on my monitor and maybe you can go from there
VBA Code:
Sub OnScreenRange()

    Dim rngStr As String, ray As Variant

    ray = Split(Replace(ActiveWindow.ActivePane.VisibleRange.Address, ":", ""), "$")
    rngStr = "Range(" & Chr(34) & ray(1) & ray(4) & ":" & ray(3) & ray(4) & Chr(34) & ")"
    MsgBox "Last row on screen is" & vbLf & rngStr
    ActiveWindow.ScrollRow = ray(4) - 10
    
End Sub
 
Upvote 0
Thanks. I was only really looking to get the visible address as I'd've written something for the rest. I only included all the info so you could see what I was doing. I shall give this a go tomorrow when I'm a bit more awake... Thanks
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,517
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top