How to scroll through the windows of Excel through VBA code

Source: Internet
Author: User
Tags readable split first row

① Scrolling Line

Worksheets ("Sheet1"). Activate

Activewindow.scrollrow = 14

Code Explanation: The function of the above code is to activate Sheet1 first, use it as the active worksheet, and then automatically drag the vertical scroll bar to drag the 14th row to the first row, where the first row to the 13th line is dragged above the window and cannot be seen, while the 14th row is displayed at the top of the visual window ( The first row position in the visual range).

Knowledge related to:

In Excel, the function of the ScrollRow property is to return or set the line number at the top of the specified pane or window. A Long type, readable and writable.

Scrollrow-scrollrow Property Description

If the specified window is in a split state, the ScrollRow property of the Window object represents the upper-left pane. If some panes are frozen, the ScrollRow property of the Window object will not include the frozen area.

② scrolling Columns

Worksheets ("Sheet2"). Activate

Activewindow.scrollcolumn =6

Code Explanation: The function of the above code is to activate Sheet2 first, use it as the active worksheet, and then automatically drag the horizontal scroll bar to drag the 6th column to the position of the first column, where the first column to column 5th will be dragged to the left of the window and not visible, while the 6th column is displayed at the far left of the visual window ( The first column position in the visual range).

Knowledge related to this:

Window.scrollcolumn Property

Returns or sets the leftmost column number of the specified pane or window. Long, readable and writable.

Grammar

An expression. ScrollColumn

Expression A variable that represents a Window object.

Note: If the window is in a split state, the ScrollColumn property of the Windows object represents the upper left pane. If some panes are frozen, the ScrollColumn property of the Window object will not include the frozen area.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.