Replacing Null Characters (ASCII Value "0")

newyorkpaulie

New Member
Joined
Dec 1, 2002
Messages
34
I'm trying to replace Null Characters in some data I have imported. The null characters show up as a small black rectangle in the cell.

I tried "edit / replace" but could not figures out how to get a "null character" in the "find what" box. It doesn't seem that you can copy/paste it in.

Also tried the following VB Code.

That does not work either.

Anyone know how to do this?


Sub ReplaceNull()
Null_Character = Chr(0)
Selection.Replace What:=Null_Character, Replacement:="xxxzzz", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Sub
 

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 newyorkpaulie:

A suggestion -- have you tried the CLEAN function together with the TRIM function as in

=CLEAN(A1)
 
Upvote 0
Now I feel a little dumb !!!

The CLEAN function works great.

I got so focused on the "edit / replace", I didn't even think of CLEAN.

BUT, it would still be optimal to be able to put the NULL character in "replace" to clean up the data in one fell swoop.

Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,223,743
Messages
6,174,244
Members
452,553
Latest member
red83

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