Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Sub Clean_Trim() Application.EnableCancelKey = xlDisabled '// CLEAN > Removes all nonprintable characters from text. '// TRIM > Removes all spaces from text except for single Dim CleanTrimRg As Range Dim oCell As Range Dim Func As WorksheetFunction Set Func = Application.WorksheetFunction On Error Resume Next If Err Then MsgBox "No data to clean and Trim!": Exit Sub For Each oCell In Excel.Selection With oCell If .HasFormula = False Then oCell = Func.Clean(Func.Trim(oCell)) End If End With Next End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.