Remove All Special Characters

JADownie

Active Member
Joined
Dec 11, 2007
Messages
395
I have an Excel file (form) with several macros embedded that do a variety of functions. When a user saves their Excel file, I have a macro which creates a CSV copy of the values input so that I can load to my database. From time to time, a user will copy and paste something into the Excel file which has a special character. My database is unable to read files with special characters, so as a result, no CSV file is generated when the user saves. I would like to write a macro that searches all sheets in the file and removes any special non text characters. Does anyone have a macro they currently use for this now. Thank you in advance.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How to include dots and spaces?
Do you mean include them so they will not be deleted? If so, dots (periods I presume) are easy but spaces would depend on what kind of text you have and how they should look afterwards. For example, could you have multiple adjacent spaces and, if so, should they all remain (currently, my code collapses multiple spaces down to single spaces)? What about text like AB-CD... should the dash be deleted or converted to a space (currently, my code replace the dash with a space)? There are probably other situations I am not thinking of at the moment, so it would be helpful if you posted several representative example text strings that you could have and then show us what you want them to look like afterwards.
 
Upvote 0

Forum statistics

Threads
1,222,564
Messages
6,166,818
Members
452,074
Latest member
Alexinho

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