Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default A better way to get rid of spaces

I'm looking for a better way to get rid of the spaces directly before and
after the values in my cells. When I double click the values, I see the
cursor blinking one space to the right of the data, like this: 'Sales . The
period is where the cursor sits blinking. Without double clicking the cell,
it says: Sales No cursor appears on the unactivated cell (obviously). I
know about the "TRIM" function in order to get rid of before and after
spaces, but I don't want to have to move the data around in order to do a
vlookup. I tried using Find & Replace, but that only helps me find values
that are not formula. Is there a way to replace the spaces on the outside?
Any push in the right direction would be very appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default A better way to get rid of spaces

Take a look he

http://www.mvps.org/dmcritchie/excel/join.htm#trimall



In article ,
"The parawon" wrote:

I'm looking for a better way to get rid of the spaces directly before and
after the values in my cells. When I double click the values, I see the
cursor blinking one space to the right of the data, like this: 'Sales . The
period is where the cursor sits blinking. Without double clicking the cell,
it says: Sales No cursor appears on the unactivated cell (obviously). I
know about the "TRIM" function in order to get rid of before and after
spaces, but I don't want to have to move the data around in order to do a
vlookup. I tried using Find & Replace, but that only helps me find values
that are not formula. Is there a way to replace the spaces on the outside?
Any push in the right direction would be very appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default A better way to get rid of spaces

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"The parawon" wrote in message
...
I'm looking for a better way to get rid of the spaces directly before and
after the values in my cells. When I double click the values, I see the
cursor blinking one space to the right of the data, like this: 'Sales .

The
period is where the cursor sits blinking. Without double clicking the

cell,
it says: Sales No cursor appears on the unactivated cell (obviously).

I
know about the "TRIM" function in order to get rid of before and after
spaces, but I don't want to have to move the data around in order to do a
vlookup. I tried using Find & Replace, but that only helps me find values
that are not formula. Is there a way to replace the spaces on the

outside?
Any push in the right direction would be very appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default A better way to get rid of spaces

Hi

Copy the code below into a module, highlight your problem cells, press
Alt/F8 and run the macro:

Sub trimit()

For Each c In Selection
c.Value = Trim(c.Value)
Next

End Sub

Another way is to trim the cells in another row then copy, paste special,
values over the top or original data. However, this won't work on a formula
as it will copy the value over the formula.


"The parawon" wrote in message
...
I'm looking for a better way to get rid of the spaces directly before and
after the values in my cells. When I double click the values, I see the
cursor blinking one space to the right of the data, like this: 'Sales .
The
period is where the cursor sits blinking. Without double clicking the
cell,
it says: Sales No cursor appears on the unactivated cell (obviously).
I
know about the "TRIM" function in order to get rid of before and after
spaces, but I don't want to have to move the data around in order to do a
vlookup. I tried using Find & Replace, but that only helps me find values
that are not formula. Is there a way to replace the spaces on the
outside?
Any push in the right direction would be very appreciated.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default A better way to get rid of spaces

As long as there are no formulas in that data :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Steve" wrote in message
...
Hi

Copy the code below into a module, highlight your problem cells, press
Alt/F8 and run the macro:

Sub trimit()

For Each c In Selection
c.Value = Trim(c.Value)
Next

End Sub

Another way is to trim the cells in another row then copy, paste special,
values over the top or original data. However, this won't work on a

formula
as it will copy the value over the formula.


"The parawon" wrote in message
...
I'm looking for a better way to get rid of the spaces directly before

and
after the values in my cells. When I double click the values, I see the
cursor blinking one space to the right of the data, like this: 'Sales .
The
period is where the cursor sits blinking. Without double clicking the
cell,
it says: Sales No cursor appears on the unactivated cell (obviously).
I
know about the "TRIM" function in order to get rid of before and after
spaces, but I don't want to have to move the data around in order to do

a
vlookup. I tried using Find & Replace, but that only helps me find

values
that are not formula. Is there a way to replace the spaces on the
outside?
Any push in the right direction would be very appreciated.





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
Spaces [email protected] Excel Worksheet Functions 6 January 8th 07 03:53 PM
spaces not recognized as spaces windsurferLA Excel Worksheet Functions 9 July 27th 06 11:49 AM
Help copying a range with spaces to a range without spaces Andy Excel Programming 1 September 23rd 03 04:26 PM
Spaces Steve Wylie Excel Programming 7 August 28th 03 07:46 PM


All times are GMT +1. The time now is 04:46 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"