Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Trim spaces on both sides

Hi There,

How do you trim spaces a text in a column content on both
sides say for example leading and trailing spaces before I
save them to a CSV file. I am creating a macro that do
automatically save my file without modifying them manually.

I use TRIM but it didn't work.

TIA
Eric

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trim spaces on both sides

Trim does what you describe. It removes spaces [ chr(32) ] on each end.
Perhaps you have some characters besides chr(32) that look like spaces.
chr(160) for example.

If so, and you use Excel 2000 or later, you could use the replace function
to clean those. You might have to parse out the string and see what you
have.

--
Regards,
Tom Ogilvy


"Eric" wrote in message
...
Hi There,

How do you trim spaces a text in a column content on both
sides say for example leading and trailing spaces before I
save them to a CSV file. I am creating a macro that do
automatically save my file without modifying them manually.

I use TRIM but it didn't work.

TIA
Eric



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trim spaces on both sides


Trim works fine for me, what code are you using

--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26522

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Trim spaces on both sides

Hi Eric,
An example of a macro using TRIM
http://www.mvps.org/dmcritchie/excel/join.htm#trimall

If it doesn't work you will have to determine what characters you
actually have see the topic above that one.

Also check to see what you get
="*" & A1 & "*"
="*" & TRIM(A1) & "*"
=CODE(A1)
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Eric" wrote
How do you trim spaces a text in a column content on both
sides say for example leading and trailing spaces before I
save them to a CSV file. I am creating a macro that do
automatically save my file without modifying them manually.

I use TRIM but it didn't work.

TIA
Eric



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 you remove trailing spaces withour Trim function? RajenRajput1 Excel Discussion (Misc queries) 8 July 27th 09 05:16 PM
Trim function to remove blank spaces in Excel Natty Excel Discussion (Misc queries) 1 June 26th 08 03:31 PM
Trim Leading Spaces Steven Excel Worksheet Functions 6 February 21st 07 11:21 PM
trim leading spaces captain bob Excel Discussion (Misc queries) 2 August 3rd 06 02:57 PM
How to trim spaces from entered text in cell using exisiting functions? rj Excel Worksheet Functions 4 April 19th 06 08:40 PM


All times are GMT +1. The time now is 02:49 AM.

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

About Us

"It's about Microsoft Excel"