What is VBA LTRIM Function
The VBA LTRIM function is listed under the text category of VBA functions. When you use it in a VBA code, it can remove the leading spaces from the string supplied. In simple words, it can remove all those unwanted leading spaces from a string.
how to use it
To use VBA's LTRIM function you need to understand its syntax and arguments:
- String: The text string from which you want to remove the leading spaces.
Example to use LTRIM Function in VBA
To practically understand how to use VBA LTRIM function, you need to go through the below example where we have written a vba code by using it:
Sub example_LTRIM() Range("B1").Value = LTrim(Range("A1")) End Sub
Below are some important points which you need to take care while using LTRIM function in VBA.
- If the supplied string is NULL, then it will return NULL in the result.
About the Author
Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.