Be the first user to complete this post

  • 0
Add to List

VBA-Excel : Strings Functions – Left

Description:

Returns a string containing number of characters specified by the user, starting from left side of the input string.

Format:

Left(strMainString,intLength,)

Arguments:
  • strMainString
    • Mandatory
    • Type: String
    • String whose characters to be returned.

    • intLength
      • Mandatory
      • Type: Numeric
      • Number of characters to be returned.
      • If number specified 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()                       |                         InstrREV()                       |                        LCase()

UCase()                      |                         Left()                                |                        Right()

LTrim()                        |                         Mid()                                 |                        Trim()

RTrim()                       |                        Replace()                          |                        Space()

Len()                           |                        StrComp()                         |                        String()

Happy Macro­ing :)

Sumit Jain



Also Read:

  1. Excel-VBA : Range - Lock/Unlock Specific Cells
  2. VBA-Excel: Date-Time Functions – DatePart()
  3. VBA-Excel: Date-Time Functions – DateDiff()
  4. VBA-Excel : 3D-Ranges – FillAcrossSheets Method
  5. VBA-Excel : Strings Functions – Instr
  6. VBA-Excel: Get all the WeekDays or Working days in Specified Date Range, (excluding Satudays and Sundays)
  7. VBA-Excel: String Functions – Len()
  8. VBA Excel - Cells, Ranges and Offset : Range