Class Pane (Excel VBA)

The class Pane represents a pane of a window.

The main procedure of class Pane is Activate

Set

To use a Pane class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim wnd As Window: Set wnd = 
Dim panPane As Pane
Set panPane = wnd.Panes(Index:=lngIndex)

The following procedures can be used to set variables of type Pane: Panes.Item, Window.ActivePane and Window.Panes

For Each

Here is an example of processing the Pane items in a collection.

Dim wnd As Window: Set wnd = 
Dim panPane As Pane
For Each panPane In wnd.Panes
	
Next panPane

Methods

This is the main method of the Pane class

Activate - Activates the pane.

Other Methods

LargeScroll - Scrolls the contents of the window by pages.

ScrollIntoView - 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).

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

SmallScroll - Scrolls the contents of the window by rows or columns.

Properties

Index returns a Long value that represents the index number of the object within the collection of similar objects.

Parent returns the parent object for the specified object. Read-only.

ScrollColumn returns or sets the number of the leftmost column in the pane or window.

ScrollRow returns or sets the number of the row that appears at the top of the pane or window.

Worksheets("Sheet1").Activate 
ActiveWindow.ScrollRow = 10

VisibleRange returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range.

Worksheets("Sheet1").Activate 
MsgBox "There are " & Windows(1).VisibleRange.Cells.Count _ 
 & " cells visible"

Panes.Count returns a Long value that represents the number of objects in the collection.

Panes.Item returns a single object from a collection.

Worksheets(1).Activate 
ActiveWindow.Split = True 
ActiveWindow.Panes.Item(3).ScrollRow = 5

Panes.Parent returns the parent object for the specified object. Read-only.