Sub TrimText()

  Dim c As Range
  Dim AppCalcMode As XlCalculation

  Application.ScreenUpdating = False
  AppCalcMode = Application.Calculation
  Application.Calculation = xlCalculationManual

  For Each c In Selection.Cells
    c.Value2 = Trim(c.Value2)
  Next c
  Application.Calculation = AppCalcMode
  Application.ScreenUpdating = True
End Sub
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter