WorksheetFunction.Trim (Excel)

Removes all spaces from text except for single spaces between words. Use Trim on text that you have received from another application that may have irregular spacing.

Trim (Arg1)

Arg1: Text - the text from which you want spaces removed.


Dim strArg1 As String: strArg1 = 
Dim strTrimmed As String
strTrimmed = WorksheetFunction.Trim(Arg1:=strArg1)