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 – Right


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



  • 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 FnRight()

   Dim mainString

   mainString = "SumitJain"

   intLngth = 5

   MsgBox "The first " & intLength & " characters from Right are ' " & Right(mainString, intLngth) & " '"    

End Function 


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

You may also like...

Leave a Reply

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

%d bloggers like this: