Be the first user to complete this post

  • 0
Add to List

VBA-Excel: String Functions – Len()

Description:

The Len function returns the number of characters in a string including spaces.

Format:

Len (strMainString)

Arguments:
  • strMainString
    • Mandatory
    • Type: String
    • String who’s both number of characters to be returned.
Function FnLen()

    Dim strMainString

    strMainString = "   Sumit Jain  "

    MsgBox "No of characters (including spaces) are” & Len(strMainString)    

End Function
Len()
Len()

Also Read About  Other String() Functions

INSTR()                       |                         InstrREV()                       |                        LCase()

UCase()                      |                         Left()                                |                        Right()

LTrim()                        |                         Mid()                                 |                        Trim()

RTrim()                       |                        Replace()                          |                        Space()

Len()                           |                        StrComp()                         |                        String()



Also Read:

  1. VBA Excel - Cells, Ranges and Offset: Refer to Cells by Using Shortcut Notation
  2. VBA-Excel: String Functions – strComp()
  3. VBA-Excel: Date-Time Functions – Date(), Now() and Time()
  4. VBA-Excel: Date-Time Functions – DateSerial()
  5. VBA-Excel: Date-Time Functions – IsDate()
  6. VBA-Excel : Strings Functions – Ucase
  7. Excel-VBA : Range - Lock/Unlock Specific Cells
  8. VBA-Excel : Strings Functions – Right