Right VBA function – How to use the Right function

Last Updated on January 11, 2023 by token

1. RIGHT VBA function – Description

The RIGHT function in VBA cuts the specified number of characters from the text starting from the right side. It can be compared to the RIGHT function in an Excel worksheet. The function cuts text from other text starting from the right side. For example, from the sentence “I am a programmer” we can cut out the word “programmer”.

2. RIGHT function – Syntax

Right function syntax is as follows:

RIGHT(String, Length)

String – A text string from which to cut the text starting from the right side

Length – In the argument, we can specify how many characters from the string we want to cut from the String argument.

Function return : String / text value

3. VBA RIGHT function Example

How to use RIGHT function in VBA Excel? Below is an example of using the RIGHT   function in the VisualBasic Editor.

Sub RightFunctionExample ()

MsgBox Right ("VBA Function Learning", 13)
Range ("A1") = Right ("VBA learning function", 13)
MsgBox Right (Range ("A1"), 7)

End Sub
Excel VBA Functions - Right VBA function
Excel VBA Functions – Right VBA function

Leave a comment

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

%d bloggers like this: