Hi Adgjqetuo,
The code to replace all of the special characters you've specified can be shortened to:
Sub test()
Dim myString As String, ce As Range, i As Long
Application.ScreenUpdating = False
For Each ce In Range("A1:V500")
For i = Len(ce.Value) To 1 Step -1
Select Case Mid(ce.Value, i, 1)
Case Is = "`", "!", "@", "#", "$", "%", "^", "&", "(", ")", "_", "-", "=", "+", _
"{", "[", "}", "]", "\", "|", ";", ":", "'", """", ",", "<", ".", ">", "/"
myString = Replace(ce.Value, Mid(ce.Value, i, 1), "")
ce.Value = myString
Case Else
' Do Nothing
End Select
Next i
myString = ""
Next ce
Application.ScreenUpdating = True
End Sub
This doesn't prompt the user whether they want to do the replacements, or show a results window with the count of each special character replaced. Is the latter really important? (Do the users care that 18 . and 4 / were removed?) If you absolutely need those features, they can be (somehow) added to this code.
PS - Try this code on a backup copy of your workbook. Don't want you deleting something important.
Bookmarks