bbb bag

Excel TRIM VBA Function

The Excel LTrim VBA function is important to use when you are working with data derived from locations where there could be leading spaces.  This could prevent you from identifying the content of the variable successfully.

This function is simple to use, see the example below.

Dim FindtheText As String
Dim Lookingatstring As String
FindTheText = LTrim(Lookingatstring)
'For this example, pretend the LookingatString = " Testing" with 2 spaces in the beginning
'FindTheText will now equal "Testing" without the 2 leading spaces


If you had an IF statement that was looking for an exact match such as “Testing” and you did not use the LTRIM method, the logic would not identify the string as “Testing” but as ”  Testing” and not perform the appropriate logic.

Need Support or Help?

Send us an Email, we'll get back to you asap.

Frequently Asked Questions

Our FAQ may answer some questions that you about our company & services.

Anything else we can do?

We'd love to hear from you. Contact us to see how we can help.

Hundreds of Satisfied Clients

Excel Help