Easiest way to replace spaces in a selection or within a sheet is by the ‘Find and Replace’ dialogue box.
Step 1 – Open ‘Find and Replace’ dialogue box by pressing ‘Control + H’. In the ‘Find What’ box enter a space. Leave the ‘Replace With’ box as blank. Now select ‘Replace All’.
Step 2 – Excel deletes all spaces within the selected area.
Search engine keywords for this question
How to delete blanks a sheet
How to remove blank cells