I'm looking for an UDF Indent Function. There is one in the link below, but this is not true Indent. It is spaces before the text. Any suggestions?
http://www.excelforum.com/excel-gene...-function.html
I'm looking for an UDF Indent Function. There is one in the link below, but this is not true Indent. It is spaces before the text. Any suggestions?
http://www.excelforum.com/excel-gene...-function.html
Last edited by mkvassh; 05-16-2010 at 12:27 PM.
What are you trying to achieve with the Indent. Would you want to apply different levels of indents based on cell criteria/formatting? Would a macro using the InsertIndent method in VBA meet your requirements?
Hi
Don't know if u like it but u can use this function
=IF(ISNUMBER(A1),B1,CONCATENATE(REPT(" ",10),B1))
See attached for more info...
Люди, питающие благие намерения, как раз и становятся чудовищами.
Regards, ?Born in USSR?
Vusal M Dadashev
Baku, Azerbaijan
Excel wont allow a "True Indent" as indenting generally uses tab, which cells wont accept :-
=REPT(CHAR(9),4)&"TEXT"
char 9 is the tab character, so the only way to emulate is to use spaces as in the udf you referenced
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
OK. Thank you
Try this. E.g.,
=SetIndent(A1, B1), where A1 is the cell to be indented, and B1 contains the indent level.
![]()
Function SetIndent(r As Range, ByVal Level As Long) As Variant ' shg 2008 ' Sets the indent level of r from 0 to 15 and returns the indent level Dim cell As Range SetIndent = IIf(Level < 0, "Min is 0!", IIf(Level > 15, "Max is 15!", Level)) If Level < 0 Then Level = 0 Else If Level > 15 Then Level = 15 For Each cell In r With cell If Level - .IndentLevel Then .InsertIndent Level - .IndentLevel End With Next cell End Function
Entia non sunt multiplicanda sine necessitate
Holy cow this works unbelievably well.
This is a great function! Thanks.
Just a note on behavior: the formula is placed parallel to the cell with the original text, and when recalc'ed, actually modifies the original text.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks