The Trim function in VBA removes the leading and trailing spaces from the specified string.

Syntax

Parameter

String (required) – This parameter represents the string from which you want to remove the leading and trailing spaces.

Return

This function returns a string after removing the leading and trailing spaces from the given string

Example 1

Output

Name: Joe Jonas Address: Street   34 Manhattan, US
VBA Trim Function

Example 2

Output

VBA Trim Function2
VBA Trim Function3
VBA Trim Function4

Pin It on Pinterest

Share This