Remove strange non-printing character

Jubjab

Well-known Member
Joined
Jan 3, 2007
Messages
995
Hi,

I am importing some data from a very non-excel-supportive database. The only export option in the database is RTF. It uses text boxes for all data. I open it in word, "save as" as text file (.txt), and open in Excel. All monetary values over 1000 are imported with a space (i.e. 50000 is imported as 50 000).

The problem is that even though it appears to be a normal space character, I can't seem to remove it automatically.

* Edit->Replace with a space in the search box does not work
* According to the CODE function, the space is chr(160). A VBA replace with that does, however, not work.
* TRIM will not get rid of the space

If I ctrl-C the blank space and paste it into the replace box, it works, but only directly after I have opened the file. After I have run my sorting macro, it won't work anymore. I tried recording a macro when running this ctrl-C operation, and it recorded a normal blank space (which doesn't work if run).

What makes it even more strange, is that the file I open is in txt format!

Note that I can't make the replace before anything else (while it still works), as I don't want to remove the spaces from text fields.

Any ideas?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi Jubjab

According to the CODE function, the space is chr(160). A VBA replace with that does, however, not work.

I've just tried it and it worked. Replaced it with a normal space

Range("A1").Replace Chr(160), " ", lookat:=xlPart

Hope this helps
PGC
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,674
Members
449,179
Latest member
fcarfagna

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top