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-容x
------------------------------------------------------------------------
T-容x's Profile:
http://www.excelforum.com/member.php...o&userid=26572
View this thread:
http://www.excelforum.com/showthread...hreadid=398507