![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com