Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove spaces from a string variable


Use the Replace method of Strings:

* To remove all spaces:
Replace(YourStringWithSpaces, " ", "")

* To replace spaces with underscores:
Replace(YourStringWithSpaces, " ", "_")

Hope this helps...

blatham Wrote:
Does anyone know if there is a function to remove or replace spaces
within a string variable in VBA. I want something similar to the TRIM
function that also removes spaces from middle of the string as well as
the ends.

Thanks



--
T-Žex
------------------------------------------------------------------------
T-Žex's Profile: http://www.excelforum.com/member.php...o&userid=26572
View this thread: http://www.excelforum.com/showthread...hreadid=398507

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 all spaces in a text string dn Excel Discussion (Misc queries) 3 April 2nd 23 07:20 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Find String in another string - only between spaces Nir Excel Worksheet Functions 9 November 2nd 06 11:31 AM
how do I remove empty spaces trailing a text string? Need_Help Excel Worksheet Functions 2 June 7th 05 12:13 AM
Remove Spaces Ronbo Excel Programming 3 March 9th 05 02:53 AM


All times are GMT +1. The time now is 01:45 PM.

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"