I found that by running Mordred's macro twice, and then relacing spaces with "", all special characters in my sample were removed. Don't know why you had to run it twice, but apparently some characters can't be removed if they are adjacent to a space, and some spaces can't be removed if they are adjacent to a special character. I solved it by adding back the "trim" formula, and by repeating the macro twice. Not pretty, but seems to work.
Thanks for your help, Mordred.
Sub RemoveSpecialCharacters()
Dim ws As Worksheet
Dim oC As Range, l As String
Dim isSChar As Boolean
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.ActiveSheet.UsedRange
ActiveSheet.UsedRange.Select
Selection.Replace What:="á", Replacement:="", Lookat:=xlPart
For Each Cell In Selection
Cell.Value = Trim(Cell.Value)
Next
isSChar = False
Set ws = ActiveSheet
For Each oC In ws.UsedRange
l = Right(oC.Value, 1)
If l < Chr(48) Or l > Chr(57) Then
If l < Chr(65) Or l > Chr(90) Then
If l < Chr(97) Or l > Chr(122) Then
isSChar = True
Else
isSChar = False
End If
Else
isSChar = False
End If
Else
isSChar = False
End If
If isSChar = True Then oC.Value = Replace(oC.Value, l, "")
Next oC
Application.ActiveSheet.UsedRange
ActiveSheet.UsedRange.Select
Selection.Replace What:="á", Replacement:="", Lookat:=xlPart
For Each Cell In Selection
Cell.Value = Trim(Cell.Value)
Next
isSChar = False
Set ws = ActiveSheet
For Each oC In ws.UsedRange
l = Right(oC.Value, 1)
If l < Chr(48) Or l > Chr(57) Then
If l < Chr(65) Or l > Chr(90) Then
If l < Chr(97) Or l > Chr(122) Then
isSChar = True
Else
isSChar = False
End If
Else
isSChar = False
End If
Else
isSChar = False
End If
If isSChar = True Then oC.Value = Replace(oC.Value, l, "")
Next oC
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks