① 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.