Could you provide a comprehensive list so that we know exactly what you want removed?Remove all special characters and punctuation from excel sheet
Sub DeleteNonAlphaNumericChars()
Dim Constants As Range
Dim Char As String
Dim Txt As String
Dim Cell As Range
Dim i As Integer
' Change sheet name as needed:
Const SheetName = "Sheet1"
Set Constants = ThisWorkbook.Sheets( _
SheetName).Cells.SpecialCells( _
xlCellTypeConstants)
For Each Cell In Constants
Txt = vbNullString
For i = 1 To Len(Cell.Text)
Char = Mid(Cell.Text, i, 1)
Select Case Asc(Char)
Case Asc("0") To Asc("9"):
Txt = Txt & Char
Case Asc("a") To Asc("z"):
Txt = Txt & Char
Case Asc("A") To Asc("Z"):
Txt = Txt & Char
End Select
Next i
Cell.Value = Txt
Next Cell
End Sub
So if the text isI want to retain only number and letters.
How big is your data and where is it? That is, what columns/rows need to be checked?
To follow up on Peter's questions, what about hyphenated words. For example...So if the text is
Simon's book is red.
you want it changed to
Simons book is red
That is, remove both the period at the end and the apostrophe?