Removing Special characters in excel sheet.

rgarg06

New Member
Joined
Oct 16, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi Guys, I am trying to remove all the special character in excel sheet at once. But replacing the special characters one by one is not helping though. Is there any other way to do that or through VBA?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Maybe this way
VBA Code:
Sub MM1()
    Const sBad As String = "`!@#$;^()_-=+{}[]\|;:'"",.<>/?"
    Dim cell As Range, s As String, i As Long
    Application.ScreenUpdating = False
    For Each cell In ActiveSheet.UsedRange
        If VarType(cell.Value) = vbString Then
            s = cell.Value
            For i = 1 To Len(sBad)
                s = Replace(s, Mid(sBad, i, 1), "")
            Next i
            cell.Value = Application.Trim(s)
        End If
    Next cell
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Not sure what your special chars are. This will remove non printable characters.

VBA Code:
Sub CleanCells()
    Dim r As Range
    For Each r In UsedRange
        r = WorksheetFunction.Clean(r)
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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