Click here to Skip to main content
15,888,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I was writing a simple replace script to remove all spaces from a EXCEL Spreadsheet using the built in VBA editor. The code looked to be running fine on data that had been copied and pasted into a blank spreadsheet. However I noticed that some spaces remained. On copying one of these into Word and showing formatting characters and symbols I was given the characters that are seen on the top row of my image. The second row is a copy of the top row with those characters removed and a normal space entered to show the difference. Has anyone come across this character and if so what is it?

Image Link[^]




Thanks

Harry
Posted
Comments
ZurdoDev 30-Jan-15 10:05am    
You can check the character code in Excel using the Code function. You can also use the Clean function would should get rid of that.
CHill60 30-Jan-15 12:23pm    
Looks like the non-breaking space special character (so word wrap will not break a line at that point unlike a normal space)

1 solution

Just checked and that is indeed a "non-breaking space" special character.

Unfortunately the CLEAN() function does not remove it (because it is printable as a space)

However
fixedText =substitute(dodgyText,char(160),"")
will tidy it up
 
Share this answer
 
Comments
hcompston 13-Feb-15 13:59pm    
Hi Chill60, Sorry for the time took to get back to you. Thanks for that I could not find the answer anywhere. I will incorporate that into the clean up formula.

Thanks

Harry

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900