How to select a sheet in VBA when sheet name has parentheses in it

  • Thread starter Thread starter SJ
  • Start date Start date
S

SJ

Hi there,
I am trying to select a sheet using

xlBook.Sheets("AP-STT(U)").Select

as you can see the sheet name has parentheses in it, so excel gives me a
"Subscript out of range" error.

If I select any other sheet that doesn't contain parenthesis then it works
fine.

Any ideas on how I should be going about this.

Yes, I am a newbie to excel object model.

oh yeah, Office XP I think.
 
Check your spelling (any leading/trailing/embedded spaces?)

And if xlBook isn't the active workbook, you'd get a different error.

If you're going to use .select, make sure you activate that workbook first.
 

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