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:


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.

Was this article helpful?

+2 -2


  • russom
    How to calculate indent level in vba excel?
    1 year ago
  • mezan
    How to indent messages in vba?
    9 months ago
  • Aija
    How to reverse indent excel vba?
    3 months ago

Post a comment