Deleting Special Characters from Excel Text Cell

hunter.t.j

New Member
Joined
Mar 20, 2007
Messages
23
I have text cells that contain special characters because people COPY and PASTE text from other word processors. Is there a way to remove SPECIAL Characters from these Cells.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi - Welcome to the board :)

TRIM and CLEAN are possibly two formula options you may want to look at :)
 
Upvote 0
A trick I use is to copy the info into Word, either with or without the cell formatting. Word has a find and replace that you can use special characters. I usually have to remove tabs from a file so it will format correctly in notepad. So I find the tabs and replace it with a blank.
 
Upvote 0
Clean & Trim

Option Explicit

Sub Clean_Trim()
'// From Help Files:
'// CLEAN > Removes all nonprintable characters from text.
'// Use CLEAN on text imported from other applications that
'// contains characters that may not print with your
'// operating system.
'// For example, you can use CLEAN to remove some low-level
'// computer code that is frequently at the beginning and end
'// of data files and cannot be printed.

'// TRIM > Removes all spaces from text except for single
'// spaces between words. Use TRIM on text that you have
'// received from another application that may
'// have irregular spacing.

Dim CleanTrimRg As Range
Dim oCell As Range
Dim Func As WorksheetFunction

Set Func = Application.WorksheetFunction

On Error Resume Next
Set CleanTrimRg = Selection.SpecialCells(xlCellTypeConstants, 2)
If Err Then MsgBox "No data to clean and Trim!": Exit Sub

For Each oCell In CleanTrimRg
oCell = Func.Clean(Func.Trim(oCell))
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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