VBA – Scroll Vertically and Scroll Horizontally

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on December 5, 2022

You may need a workbook to always open to a specific view or location on a sheet, or possibly just change the view from a macro. You can do this by using the ScrollRow and ScrollColumn.


Used to programmatically scroll a spreadsheet vertically. This example will scroll a spreadsheet to row 5.

ActiveWindow.ScrollRow = 5


Used to programmatically scroll a spreadsheet horizontally. This example will scroll a spreadsheet to column 5.

ActiveWindow.ScrollColumn = 5

AutoScroll to Certain Row & Column On Workbook Open

And placing the following code in a module will always scroll a workbook’s Sheet1 to row 5 and column 5 if macros are enabled upon opening:

Sub auto_open()
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollRow = 5
End Sub

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text


Learn More!



VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples