Level of Indentation of a cell

M

Muk

Hi,
Is there any way to check the Level of Indentation in a cell through macro ?

If so Please help me out Thanks in Advance
Muk
 
J

Jacob Skaria

Range("A1").IndentLevel will give you the values 0,1,2,3...


If this post helps click Yes
 
P

pat martin

Hi Jacob,

I saw your post for getting the indent level on a particular cell, but I must admit this wasn't enough information for me to create a macro that will return the information I want.

I would like to get the indent level property from one column of cells say, range("B1:B500"), and show then in another column ("A1:A500"). I am no VB programmer, but I do have some rudimentary understanding of the syntax.

Anymore detail would be appreciated

Thanks,
Pat
 
G

GS

pat martin explained :
Hi Jacob,

I saw your post for getting the indent level on a particular cell, but I must
admit this wasn't enough information for me to create a macro that will
return the information I want.

I would like to get the indent level property from one column of cells say,
range("B1:B500"), and show then in another column ("A1:A500"). I am no VB
programmer, but I do have some rudimentary understanding of the syntax.

Anymore detail would be appreciated

Thanks,
Pat

In a standard module...

Option Explicit

Sub GetIndentLevels()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B1:B500")
With c.Offset(, -1)
.NumberFormat = "General": .Value = c.IndentLevel
End With 'c.Offset(, -1)
Next 'c
Application.ScreenUpdating = True
End Sub
 
G

Gord

Sub test()
For Each cell In Range("B1:B500")
cell.Offset(0, -1).Value = cell.IndentLevel
Next
End Sub


Gord Dibben Microsoft Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top