'Right'

  • Thread starter Thread starter Himszy
  • Start date Start date
H

Himszy

Hi,

I have the following code and it seems to work on excel 97. On excel 2000 it
doesn't work, it gets 'stuck' at 'right'. Is there a different form of code
that will work for both?

MyVal = Right(Result1, 3)

Thanks Michael
 
Himszy

VBA's Right Function has not changed at all. I suspect that the coercion to
the type of the myVal variable may be the problem.

It would help if you gave us the error.

If it is a matter of coercion then perhaps try

CDbl(), CSng(), CInt(), etc

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
'Can't find project or library'
Nick Hodge said:
Himszy

VBA's Right Function has not changed at all. I suspect that the coercion to
the type of the myVal variable may be the problem.

It would help if you gave us the error.

If it is a matter of coercion then perhaps try

CDbl(), CSng(), CInt(), etc

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Himszy

You need to set a reference to the 'Visual Basic for Applications' library.
Open the VBE (Alt+F11) and then go to Tools>References... and select it from
the list and check the box. All should then be well

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Nick is part right. After the error, go into the VBE, then go into
Tools=>References (you might have to hit the reset button). Your project
must be the active project. In the reference listing, there should be at
least one reference marked as MISSING. If you are not using this reference,
then go back to your source workbook and remove it. then copy it back to
this machine and try again. If you are using it, then you need to get a copy
of the library installed and registered on this machine.

By the way, Right has nothing to do with the cause of the actual error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top