custom cell format

K

Karen

Is it possible to create a custom cell format or use a
macro that will create an underline under the total,
which is as long as the longest entry in the column? It
would be like Autofit, but with underlining.

I know there are underline formats that will fill the
entire width of a cell, but I'm not looking for that.
Thanks.
 
N

Norman Harker

Hi Karen!

Not a custom format but you can use:

Format > Cells > Font
Select Single from Underline drop down

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
K

Karen

Thanks Norman, but the single underline only underlines
the width of the current entry. I'm looking for
something that can underline a total line the same width
of the largest digit number in a column, even if the
total line is under a number that has fewer digits.

Perhaps there's a macro that where one can just specify
how many characters to use in an underline?

Thanks,

Karen
 
W

Walt Weber

Hi Karen,

VBA not required. This could get you there if you really
must:

A
1
2 55
3 6666
4 7777777
5 asdfg
6
7 8888888888
8 8888888888
9 8888888888
10
11 =SUM(A2:A10)
12 {=REPT("_",MAX(LEN(A1:A11)))} <-- This is an
array formula (Press Shift+Control+Enter to load).

Format cell A12: align to the right, font to Courier & set
its row height to 2.

Best Regards,
Walt
 
K

Karen

Hi Walt,

Thanks for responding. The interesting thing is that the
formula works for unformatted numbers. As soon as you
put in a format of, say, comma, then the result doesn't
adjust because it doesn't consider commas, decimals and
zeroes when doing the length count.

Thanks,

Karen
 

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

Similar Threads


Top