Indent Level Property and Insertlndent Method

The IndentLevel property returns or sets the left indent for each cell in the range and can be any integer between 0 and 15. All other settings cause an error. Presumably, indents are useful for aligning the contents of cells or for formatting text.

For instance, to set the indent level of cell A1 to 10, we can write:

Range("A1").IndentLevel = 10

Unfortunately, the documentation does not specify how big an indent unit is, but we can still use indent units in a relative way. Presumably, an indent level of 2 is twice that of an indent level of 1.

An alternative is to use the InsertIndent method, with the syntax:

RangeObject.InsertIndent(InsertAmount)

where InsertAmount is an integer between 0 and 15. However, in this case, the InsertAmount parameter specifies the amount to change the current indent for the range.

+1 -2

Responses

  • russom
    How to calculate indent level in vba excel?
    11 months ago
  • mezan
    How to indent messages in vba?
    7 months ago
  • Aija
    How to reverse indent excel vba?
    20 days ago

Post a comment