A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Here is some code that trims the cells in the current selection. Not that it can only trim constants and not the values returned by formulas. For that you would just modify the formulas.
Public Sub TrimSelection()
Dim rng As Range
Dim rngAll As Range
On Error Resume Next
Set rngAll = Selection.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rngAll Is Nothing Then
MsgBox "sorry... no constants to trim"
Else
For Each rng In rngAll
rng.Value = Trim(rng.Value)
Next rng
End If
End Sub