Home Privacy Policy Feedback Link to us Site Map Forums

Excel: LTrim Function (VBA only)


In Excel, the LTrim function removes leading spaces from a string.

The syntax for the LTrim function is:

LTrim( text )

text is the string that you wish to remove leading spaces from.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

LTrim("  Tech on the Net") would return "Tech on the Net"
LTrim("  Alphabet  ") would return "Alphabet  "

VBA Code

The LTrim function can only be used in VBA code. For example:

Dim LResult As String

LResult = LTrim("   Alphabet   ")

The variable LResult would now contain the value of "Alphabet  ".