Cannot use "Right" Function. Apparently meaning has changed.

Engineer123

New Member
Joined
Nov 21, 2019
Messages
8
I have a large VBA project I'm working on that uses the "Right" function a lot. All of a sudden it gives me an error message of...

"Compile Error

Wrong number of arguments or invalid property assignments."

When I try to compile, with the "Right" Function highlighted. What's really strange is that it worked earlier and it worked in other files.
The following code...

Private Sub RightTester()
'This should trigger a message box with the letter "g'
MsgBox (Right("String", 1))
End Sub

… works perfectly in a blank file. And will work for a while if I copy all the code into a blank file and start from there. I thought that somehow a function library got changed in that file. But it doesn't work consistently in any file I work with for any amount of time. What's really strange is that "Left" works perfectly.

Does anyone have any idea what's going on?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Check that you don't have any procedures, or variables called Right
 
Upvote 0
Glad to help & thanks for the feedback.

It's always best to avoid using VBA keywords for Procedures/variables, for just this reason. ;)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top