Add spaces to cell

N

noyb

I am concatenating last and first names into a single cell but need to
have the phantom columns line up. I know the longest last name is 17
characters long so I need a macro which will add the appropriate number
of spaces to the right of each last name. Something like
-edit cell
-calculate length
-add appropriate number of spaces to right of last character
-end edit
-next cell
Any help would be great. Thanks
 
P

philcud

using functions not vb
if names in column a
formula in b1
=LEFT(A1&" ",17)
this adds 17 spaces to the name, then returns the left 17 characters of
this new string.
 
B

Bob Phillips

=A1&REPT(" ",17-LEN(A1))&B1

you will also need a proportional font otherwise letter size throws it.
 
N

noyb

Thanks, was about to write back that I needed a font that would print
spaces at same width as letters. Have looked through ones installed but
no luck. Any suggestions?
 

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