Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Add spaces to cell

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Add spaces to cell

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Add spaces to cell

Works great,thanks

philcud wrote:
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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Add spaces to cell

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

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

--
HTH

Bob Phillips

"philcud" wrote in message
oups.com...
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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Add spaces to cell

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?

Bob Phillips wrote:
=A1&REPT(" ",17-LEN(A1))&B1

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add spaces to cell

Courier New

You want a monospaced font, not a proportional font.

--
Regards,
Tom Ogilvy


"noyb" wrote in message
...
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?

Bob Phillips wrote:
=A1&REPT(" ",17-LEN(A1))&B1

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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Add spaces to cell

Thanks again, missed it because of how it shows on screen. Prints fine
though.

Tom Ogilvy wrote:
Courier New

You want a monospaced font, not a proportional font.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Add spaces to cell



--
HTH

Bob Phillips

"Tom Ogilvy" wrote in message
...
Courier New

You want a monospaced font, not a proportional font.

--
Regards,
Tom Ogilvy


"noyb" wrote in message
...
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?

Bob Phillips wrote:
=A1&REPT(" ",17-LEN(A1))&B1

you will also need a proportional font otherwise letter size throws

it.





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Add spaces to cell

Oops, meant the non-proportional.

--
HTH

Bob Phillips

"Tom Ogilvy" wrote in message
...
Courier New

You want a monospaced font, not a proportional font.

--
Regards,
Tom Ogilvy


"noyb" wrote in message
...
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?

Bob Phillips wrote:
=A1&REPT(" ",17-LEN(A1))&B1

you will also need a proportional font otherwise letter size throws

it.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
how do I delete the last two spaces in a cell brantty Excel Discussion (Misc queries) 2 July 27th 06 01:14 AM
Adding spaces to a cell catalfamo1220 Excel Discussion (Misc queries) 3 July 18th 06 04:03 PM
Remove all spaces in a cell... killertofu Excel Worksheet Functions 8 February 20th 06 08:17 PM
Removing Spaces in a Cell carl Excel Worksheet Functions 2 October 28th 04 11:34 PM


All times are GMT +1. The time now is 03:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"