Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

VBA-Excel : Strings Functions – Left

Description:

Returns a string con­tain­ing num­ber of char­ac­ters spec­i­fied by the user, start­ing from left side of the input string.

Format:

Left(strMainString,intLength,)

Arguments:
    • str­Main­String
      • Manda­tory
      • Type: String
      • String whose char­ac­ters to be returned.

    • intLength
      • Manda­tory
      • Type: Numeric
      • Num­ber of char­ac­ters to be returned.
      • If num­ber spec­i­fied is greater than the string length then entire string is returned.
Function FnLeft()

   Dim mainString

   mainString = "SumitJain"

   intLength = 4

   MsgBox "The first" & intLength & " characters from left are ' " & Left(mainString, intLength) & " '"

End Function
Left()

Left()

Also Read About  Other String() Functions

INSTR()                       |                         Instr­REV()                       |                        LCase()

UCase()                      |                         Left()                                |                        Right()

LTrim()                        |                         Mid()                                 |                        Trim()

RTrim()                       |                        Replace()                          |                        Space()

Len()                           |                        Str­Comp()                         |                        String()

Happy Macro­ing :)

Sumit Jain


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: