Class Pane (Excel VBA)
The class Pane represents a pane of a window. To use a Pane class variable it first needs to be instantiated, for example
Dim pan as Pane
Set pan = ActiveWindow.ActivePane
For Each
Here is an example of processing the Pane items in a collection.
Dim pan As Pane
For Each pan In Application.Panes
Next pan
Activate
Activates the pane.
If the pane isn't in the active window, the window that the pane belongs to will also be activated. You cannot activate a frozen pane.
Dim booActivate As Boolean
booActivate = ActiveWindow.ActivePane.Activate()
Index
Returns a Long value that represents the index number of the object within the collection of similar objects.
Dim lngIndex As Long
lngIndex = ActiveWindow.ActivePane.Index
LargeScroll
Scrolls the contents of the window by pages.
If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three pages. If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three pages. Any of the arguments can be a negative number.
LargeScroll (Down, Up, ToRight, ToLeft)
ActiveWindow.ActivePane.LargeScroll
Arguments
Optional arguments
The following arguments are optional
Down (Long) - The number of pages to scroll the contents down.
Up (Long) - The number of pages to scroll the contents up.
ToRight (Long) - The number of pages to scroll the contents to the right.
ToLeft (Long) - The number of pages to scroll the contents to the left.
PointsToScreenPixelsX
Returns or sets a pixel point on the screen.
PointsToScreenPixelsX (Points)
Points: Location of the pixel on the screen.
Dim lngPoints As Long: lngPoints =
Dim lngPointsToScreenPixelsX As Long
lngPointsToScreenPixelsX = ActiveWindow.ActivePane.PointsToScreenPixelsX(Points:=lngPoints)
PointsToScreenPixelsY
Returns or sets the location of the pixel on the screen.
PointsToScreenPixelsY (Points)
Points: Location of the starting point.
Dim lngPoints As Long: lngPoints =
Dim lngPointsToScreenPixelsY As Long
lngPointsToScreenPixelsY = ActiveWindow.ActivePane.PointsToScreenPixelsY(Points:=lngPoints)
ScrollColumn
Returns or sets the number of the leftmost column in the pane or window.
If the window is split, the ScrollColumn property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollColumn property of the Window object excludes the frozen areas.
ActiveWindow.ActivePane.ScrollColumn =
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).
The Start argument is useful for orienting the screen display when the rectangle is larger than the document window or pane.
ScrollIntoView (Left, Top, Width, Height, Start)
ActiveWindow.ScrollIntoView _
Left:=50, Top:=20, _
Width:=100, Height:=200
Arguments
The following arguments are required:
Left (Long) - The horizontal position of the rectangle (in points) from the left edge of the document window or pane.
Top (Long) - The vertical position of the rectangle (in points) from the top of the document window or pane.
Width (Long) - The width of the rectangle, in points.
Height (Long) - The height of the rectangle, in points.
Optional arguments
The following argument is optional
Start (Boolean) - 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.
ScrollRow
Returns or sets the number of the row that appears at the top of the pane or window.
If the window is split, the ScrollRow property of the Window object refers to the upper-left pane. If the panes are frozen, the ScrollRow property of the Window object excludes the frozen areas.
Worksheets("Sheet1").Activate
ActiveWindow.ScrollRow = 10
SmallScroll
Scrolls the contents of the window by rows or columns.
If Down and Up are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the contents are scrolled up three rows. If ToLeft and ToRight are both specified, the contents of the window are scrolled by the difference of the arguments. For example, if ToLeft is 3 and ToRight is 6, the contents are scrolled to the right three columns. Any of these arguments can be a negative number.
SmallScroll (Down, Up, ToRight, ToLeft)
ActiveWindow.ActivePane.SmallScroll
Arguments
Optional arguments
The following arguments are optional
Down (Long) - The number of rows to scroll the contents down.
Up (Long) - The number of rows to scroll the contents up.
ToRight (Long) - The number of columns to scroll the contents to the right.
ToLeft (Long) - The number of columns to scroll the contents to the left.
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.
Dim rngVisibleRange As Range
Set rngVisibleRange = ActiveWindow.ActivePane.VisibleRange