Screen scrolling to show active cell

  • Thread starter Thread starter AlForester
  • Start date Start date
A

AlForester

In VBA code, when I activate or select a cell outside the visible screen
area, the cell is set but the screen is not scrolled to the active cell to
show it. I have not been able to find any command that will bring the active
cell into view.

If my screen shows rows 1-20 and columns A-P and the active cell is A1, and
I execute code Range("AZ302").Select or Range("AZ302").Activate, my screen
still shows rows 1-20, columns A-P, cell A1 is not active, cell AZ302 is
active.

How do I get the active cell to be in the visible portion of the screen?
 
Jim,
If you limit the scroll area for a sheet and you are below approximately the
halfway of the screen, activecell.show will not advance your screen.

On one of my computers, I have it set for 55 lines and the scrollarea has to
be 23 lines more than the last cell for activecell.show to bring it into
view. I had 974 lines of data and when the last cell was active, I had to
set the scroll area to include line 997 before the last cell would show.

With the same file on a smaller laptop screen showing 47 lines, the scroll
area had to be set to at least 20 lines more than the last cell to get the
last cell to show.

Explain the logic in that.
 
You can also use application.Goto myCell, true

The last argument, scroll:=true, will additionally scroll to make the
activecell the top-left cell.

Regards,
Peter T
 
Back
Top