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?