Title: VBA Remove Spaces from String in Excel | Explained with Examples
Headings: VBA Remove Spaces from String in Excel
VBA Remove Spaces from String in Excel
Macro to remove extra Spaces from String in Excel VBA
VBA Code to delete extra Spaces from String in Excel
Instructions to use Macro
Other Useful VBA Text and String Functions

Content: Finally we use TRIM function in VBA Remove Spaces macro to remove all extra spaces in a string. Table of Contents: Overview
Macro to Trim Blank Spaces from String in Excel VBA
VBA Code to remove extra Multiple Spaces from String in Excel
Instructions to use Macro
Related VBA Functions used in this article
Macro to remove extra Spaces from String in Excel VBA
Here is the best excel vba remove spaces from string macro to remove spaces in Excel. Let us see the example macros to trim,delete and remove blank spaces from String in Excel VBA. 'VBA Code to delete extra Spaces from String in Excel Sub VBA_Remove_Spaces ()  'Variable Declaration  Dim String1 As String, TempString As String  'There are multiple spaces in string  String1 = "Thanks for visiting our blog "  'Remove Extra Spaces  Do  TempString = String1  String1 = Replace (String1, Space (2), Space (1))  Loop Until TempString = String1  MsgBox "Removed Extra Spaces from String: " & vbCrLf & String1, vbInformation, "VBAF1"  End Sub
Here is the output screenshot of above macro procedure. VBA Code to delete extra Spaces from String in Excel
Let us see the example VBA Code to delete extra Spaces from String in Excel. 'VBA Code to Remove Multiple Spaces from String in Excel Sub VBA_Remove_Multiple_Spaces ()  'Variable Declaration  Dim String1 As String  Dim sResult As String  String1 = "Thanks for visiting VBAF1 "  'Remove Extra Spaces  sResult = Application. WorksheetFunction. Trim (String1)  MsgBox "Removed Extra Spaces from String: " &