ScrollIntoView Method

Microsoft Excel Visual Basic

Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).

expression.ScrollIntoView(Left, Top, Width, Height, Start)

expression    An expression that returns a Pane or Window object.

Left    Required Long. The horizontal position of the rectangle (in points) from the left edge of the document window or pane.

Top    Required Long. The vertical position of the rectangle (in points) from the top of the document window or pane.

Width    Required Long. The width of the rectangle, in points.

Height    Required Long. The height of the rectangle, in points.

Start    Optional Variant. True to have the upper-left corner of the rectangle appear in the upper-left corner of the document window or pane. False to have the lower-right corner of the rectangle appear in the lower-right corner of the document window or pane. The default value is True.

Remarks

The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.

Example

This example defines a 100-by-200-pixel rectangle in the active document window, positioned 20 pixels from the top of the window and 50 pixels from the left edge of the window.The example then scrolls the document up and to the left so that the upper-left corner of the rectangle is aligned with the upper-left corner of the window.

ActiveWindow.ScrollIntoView _
    Left:=50, Top:=20, _
    Width:=100, Height:=200