Scroll to active cell.

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I want to scroll row to the bottom of the screen where the active cell resides.

VBA Code:
ActiveWindow.ScrollRow = Selection.Row

This line will scroll to the active cell but will bring it to the top of the screen, whereas I want it to be at the bottom of the screen.

Will appreciate.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How about
VBA Code:
Application.Goto ActiveCell
 
Upvote 0
How about
VBA Code:
Application.Goto ActiveCell
Excellent, but this will scroll both the column and the row. although it does fulfil my requirment but I was trying to omit the column scroll.
I really want the column not to scroll..
 
Upvote 0
The column should only scroll if the activecell is off the screen.
 
Upvote 0
The column should only scroll if the activecell is off the screen.
Thank you Fluff for your keen interest to this problem. The Freezepanes are activated outside the active cell on the right side of the screen, so I don't want to lose the active column. I could get around this but I was hoping if it could be done with more simpler way..
 
Upvote 0
Sorry, not sure what your saying, but the active column is the column that contains the active cell and that won't change.
 
Upvote 0
Sorry, not sure what your saying, but the active column is the column that contains the active cell and that won't change.
You can see from the image below that the column Q is in selfsame position even though the cell E9 is selected from the mouse click. The Freezepanes are applied at cell F2. However If I run the code
VBA Code:
Application.Goto ActiveCell
This will lose column Q and bring column G instead.

Before running your code:
1606419862653.png


after running your code:
1606419989479.png


I hope it is clear what the problem is..
 

Attachments

  • 1606419942470.png
    1606419942470.png
    18.9 KB · Views: 10
Upvote 0
You could use something like this
VBA Code:
ActiveWindow.ScrollRow = Selection.Row - 37
But it will depend on screen size, row height, zoom setting etc.
 
Upvote 0
Another option
VBA Code:
   Dim Cl As Range
   Set Cl = ActiveCell
   Application.Goto ActiveCell.EntireRow
   Cl.Select
 
Upvote 0
Solution
Another option
VBA Code:
   Dim Cl As Range
   Set Cl = ActiveCell
   Application.Goto ActiveCell.EntireRow
   Cl.Select
I will try this. However I also did found something from my older post where I extract this line. Could it be manipulate to achieve what is required?
VBA Code:
               lastVisibleRow = .Row + .Rows.Count - 1
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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