View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Trim not working

Try

usrName=Replace(usrName," ","")

HTH

"Stuart" wrote:

Many thanks, but had tried that with a little, but not complete luck eg, if
the user string was:
sgb test 1 (ie loads of spaces) then
Application.Trim seems to result in:
sgb test 1 (ie one space between each element of the original string)
Is that the intended result?

For my purposes, I'm looking to reduce the user's data string to one
containing no 'spaces' whatsoever.

Regards.

"JE McGimpsey" wrote in message
...
VBA's Trim() function, unlike XL's TRIM(), doesn't remove internal
spaces. Is that's what's not working?

You could try:

UsrName = Application.Trim(.TbUsrName)



In article ,
"Stuart" wrote:

Might be useful if I mentioned the required end result(g),
namely to remove leading, trailing and intermediate spaces from the
string.