30 Advanced Excel Tips for 2026

Excel Champs / VBA / Top VBA Functions / VBA RIGHT Function (Syntax + Example)
By Puneet Gogia (Microsoft MVP)

VBA RIGHT Function (Syntax + Example)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

The VBA RIGHT function is listed under the text category of VBA functions. When you use it in a VBA code, it returns a sub-string from a string from the ending position. In simple words, you can extract a number of characters from a string from it is ending, which is the right side. It simply works like the RIGHT function in the worksheet.

Syntax

Right(Str, Length)

Arguments

  • Str: The string from which you want to extract a sub-string.
  • Length: The integer to specify the length of the sub-string.

Example

To practically understand how to use the VBA RIGHT function, you need to go through the below example where we have written a vba code by using it:

example-vba-right-function
Sub example_RIGHT()
Range("B1").Value = Right(Range("A1"), 6)    
End Sub

In the above code, we have used RIGHT to get the 6 characters from the right side of cell A1 (Excel Champs) and get it in cell B1. It has returned the value (Champs) in the result as these are the first 6 characters, we have in cell A1.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel