ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remove non-printing characters (https://www.excelbanter.com/excel-programming/400730-remove-non-printing-characters.html)

ian

Remove non-printing characters
 
I'm having trouble working with apperently empty cells in a
spreadsheet which has data pasted from a large Word document.


Some cells only look empty. I tried Clean which doesn't work
completetly. I don't want to try Trim as it will replace any double
spaces etc with single spaces.

Using Code on one cell I get 32, telling there is a space in the
cell, (other "empty" cells might have other Codes.)

Is there any simple Macros I can use to delete the contents of
apperently empty cells.

Thanks


Tom Ogilvy

Remove non-printing characters
 
Loop through the cells, loop through the characters in the cell and use the
replace command with a list of characters you want to remove. You could use
the Like command in your comparisons.

--
Regards,
Tom Ogilvy

"ian" wrote:

I'm having trouble working with apperently empty cells in a
spreadsheet which has data pasted from a large Word document.


Some cells only look empty. I tried Clean which doesn't work
completetly. I don't want to try Trim as it will replace any double
spaces etc with single spaces.

Using Code on one cell I get 32, telling there is a space in the
cell, (other "empty" cells might have other Codes.)

Is there any simple Macros I can use to delete the contents of
apperently empty cells.

Thanks



Niek Otten

Remove non-printing characters
 
Look at the CLEAN function. You mat also want to look at David McRitchies TRIMALL function:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ian" wrote in message s.com...
| I'm having trouble working with apperently empty cells in a
| spreadsheet which has data pasted from a large Word document.
|
|
| Some cells only look empty. I tried Clean which doesn't work
| completetly. I don't want to try Trim as it will replace any double
| spaces etc with single spaces.
|
| Using Code on one cell I get 32, telling there is a space in the
| cell, (other "empty" cells might have other Codes.)
|
| Is there any simple Macros I can use to delete the contents of
| apperently empty cells.
|
| Thanks
|



ian

Remove non-printing characters
 
Tom

Thanks. I was hoping to do this without specifying the characters to
remove (as I don't know if I'd miss any). Just to empty any cells
which look empty.

Ian


ian

Remove non-printing characters
 
On 7 Nov, 11:54, "Niek Otten" wrote:
Look at the CLEAN function. You mat also want to look at David McRitchies TRIMALL function:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall

--
Kind regards,

Niek Otten
Microsoft MVP - Excel



Thanks for pointers, using WorksheetFunction.Clean and Trim seems to
have worked.

Ian


JP[_3_]

Remove non-printing characters
 
Select your cells and try this:

Sub DeleteBlanks()
Application.ScreenUpdating = False

With Selection.SpecialCells(xlConstants)
.Replace what:=" ", Replacement:="", lookat:=xlPart,
searchorder:=xlByColumns, MatchCase:=True
End With

Application.ScreenUpdating = True
End Sub



HTH,
JP

On Nov 7, 6:35 am, ian wrote:
I'm having trouble working with apperently empty cells in a
spreadsheet which has data pasted from a large Word document.

Some cells only look empty. I tried Clean which doesn't work
completetly. I don't want to try Trim as it will replace any double
spaces etc with single spaces.

Using Code on one cell I get 32, telling there is a space in the
cell, (other "empty" cells might have other Codes.)

Is there any simple Macros I can use to delete the contents of
apperently empty cells.

Thanks





All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com