Problem with - sign in sheet name??

B

Bub

I have code that will get a range method failed error when trying to
execute the statement:
x=range(s & i) where s="Brazil-008.ord" and i is any value. The
Brazil-008.ord tab (worksheet) does exist. If I change the salur os s and
the name of the worksheet so that it does not contain the minus sign it
works great.

I have had used a worksheet named Brazil-008.ord in another set of macros
which happens to have the same statement and it works fine.

Any ideas what could be causing this? Thanks!
 
J

joel

A sheet name cannot contain a minus sign. I suspect in the othe
workbook the minus sign was not part of a string name but wa
interpreted as a real minus sign and you were perfrom a subtraction.

for example

A = 5
B = 3

A - B = 2

Which is not the same as the string

"A - B"

You code has double quotes around the variable s="Brazil-008.ord" whic
makes it a string.
 

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

Top