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

VBA-Excel: String Functions – RTrim()

Description: 

The RTrim func­tion removes spaces on the right side of a string.

Format:

Rtrim (str­Main­String)

Arguments:
  • str­Main­String
    • Manda­tory
    • Type: String
    • String whose right space needs to be trimmed.

 

Function FnRTrim()

    Dim strMainString

    strMainString = "   Sumit Jain  "

     MsgBox "Before : '" & strMainString & "' and after right Space is trimmed. After :'" &                                             RTrim(strMainString) & "'"

End Function 
Rtrim

Rtrim

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...

2 Responses

  1. Jason says:

    The RTrim func­tion removes spaces on the left side of a string.” <– should be right side of the string.

Leave a Reply

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

%d bloggers like this: