Final code is:

Sub Test()
    Dim cell As Range
    For Each cell In Selection
        cell.Value = CleanTrim(cell.Value)
    Next cell
End Sub