Possible hidden non-printable character removal

xdriver

Board Regular
Joined
Mar 21, 2014
Messages
73
Office Version
  1. 365
Platform
  1. MacOS
Here is a snippit of one of my sheets. If I select a column it counts every single column, not just the ones with data in them. If I select a bunch of "empty" cells, and click delete, then the count will be reduced by the number of cells I selected. I tried copying "empty" cells, and pasting it into View non-printable unicode characters but receive nothing because there is nothing in the cells to select. How can I clean up my sheet of non printable characters?

natickmlspublicrecords.xlsx
XYZAAABACAD
1Creation DateExteriorFireplacesFirst Floor SqftFirst NameFoundationFuel Type
2
3
4CHRISTOPHER
5ALVNL11336MICHAELOIL
6
7
8ELLEN G
9
10
11
12ALVNL1768JOHN WELEC
Sheet1
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Do you have any formulae on that sheet?
 
Upvote 0
you could try this macro.
160 is the Code for one of the zero length non printing characters.
If there are others, just add a loop to loop through the different characters that are causing errors.

You'll have to amend it to fit your range of cells you seek.
VBA Code:
Sub RemoveCharacter()
'
' RemoveCharacter Macro
'
Dim x As Variant
'
    Range("A1:P22").Select
       x = Chr(160)
 
    Selection.Replace What:=x, Replacement:=null, LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub

to search for blank cells:

1709730516127.png


after macro is run:

1709730707501.png



The pink cells are conditional formats looking for the char(160) value.







1709730640796.png
 
Last edited:
Upvote 0
Ok, try
VBA Code:
Sub xdriver()
   With ActiveSheet.UsedRange
      .Value = .Value
   End With
End Sub
 
Upvote 0
you could try this macro.
160 is the Code for one of the zero length non printing characters.
If there are others, just add a loop to loop through the different characters that are causing errors.

You'll have to amend it to fit your range of cells you seek.
VBA Code:
Sub RemoveCharacter()
'
' RemoveCharacter Macro
'
Dim x As Variant
'
    Range("A1:P22").Select
       x = Chr(160)
 
    Selection.Replace What:=x, Replacement:=null, LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub

to search for blank cells:

View attachment 107961

after macro is run:

View attachment 107963


The pink cells are conditional formats looking for the char(160) value.







View attachment 107962

This didn't seem to work either as it found none.
 
Upvote 0
do you know the character code that is causing problems?
You need to change the 160 in the vba to that number.
 
Upvote 0
do you know the character code that is causing problems?
You need to change the 160 in the vba to that number.
I don't because I can't select anything in the cell, there is nothing in them at all.
 

Attachments

  • Screen Shot 2024-03-06 at 8.19.14 AM.png
    Screen Shot 2024-03-06 at 8.19.14 AM.png
    147.3 KB · Views: 10
Upvote 0
in a cell that is really blank near a cell that has the zero length character, put this formula:
Assume it is cell C3, so put this in cell D3:
Excel Formula:
=CODE(C3)
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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