Step 1: Select the range in which you want to remove trailing spaces from cells.
Step 2: Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
Step 3: Click Insert > Module, and paste the following macro in the Module Window.
Sub NoSpaces()
Dim c As Range
For Each c In Selection.Cells
c = Trim(c)
Next
End Sub
Step 4: Press the F5 key to run this macro. And all of the trailing spaces of the selection will be removed.
Dim c As Range
For Each c In Selection.Cells
c = Trim(c)
Next
End Sub