Finance

Charts

Statistics

Macros

Search

Outline and the Outline Object with Excel VBA

The Outline object encapsulates data about the worksheet outline.
The Outline property of a worksheet returns an Outline object.
Table lists the main properties of the Outline object.

Table. Main Properties of the Outline Object

Property Description
AutomaticStyles Accepts logical values. If this property is set to True, the outline is built based on automatic styles.
SummaryColumn Returns the location of the summary columns. The allowable values are the following XlSummaryColumn constants: xlLeft (summary columns are located to the left of the columns being summarized), xlRight (summary columns are located to the right).
SummaryRow Returns the location of the summary rows. The allowable values are the following XlSummaryRow constants: xlAbove (summary rows are located above the rows being summarized), xlBelow (summary rows are located below).

Displaying a Specified Number of Outline Levels

The Outline object has a single method, ShowLevels, which displays the specified number of outline levels for rows and columns.

ShowLevels(RowLevels, ColumnLevels)

  • RowLevels — optional parameter that sets the number of displayed outline levels for rows.
  • ColumnLevels — optional parameter that sets the number of displayed outline levels for columns.

Removing an Outline

The ClearOutline method of the Range object removes an outline.
For example, the following instruction removes the outline associated with the range A1:I40:

Range("A1:I40").ClearOutline

Displaying Outline Symbols

The DisplayOutline method of the Window object accepts logical values and controls the display of outline symbols.
For example, the following instruction hides outline symbols:

ActiveWindow.DisplayOutline = False

Automatic Outline Creation

The AutoOutline method of the Range object automatically creates an outline that replaces the existing one.
If the Range object is a single cell, the outline is created for the entire worksheet.
For example, the following instruction creates an outline for the range A1:I40:

Range("A1:I40").AutoOutline
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx