keep last row added visible on the screen

B

BilBull

I add rows to a sheet by a macro.
I want to keep the last row added visible on the screen , no matter what is
the size of the window is.

Thanks

AR
 
G

Gary Keramidas

don't know what your code looks like, but maybe you can adapt this to do what
you want:

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Set ws = Worksheets("sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row

Application.Goto ws.Range("A" & lastrow - 20), scroll:=True
End Sub
 
B

BilBull

Gary Keramidas said:
don't know what your code looks like, but maybe you can adapt this to do what
you want:

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Set ws = Worksheets("sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row

Application.Goto ws.Range("A" & lastrow - 20), scroll:=True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top