Activating a Worksheet with a changing name

  • Thread starter Thread starter Sean Stuber
  • Start date Start date
S

Sean Stuber

I can't figure out why i am getting an error in this code trying to
activate the worksheet refered to by "answer" where answer might be a
string 7898789 which was entered into cells (1,1). I know normally to
refer to a sheet it needs "" ...

answer = Worksheets("NewReport").Range("ShopOrder").Cells(1, 1)
Worksheets(answer).Activate

any ideas?
 
Without testing for existence of that worksheet:

worksheets(cstr(answer)).activate

Worksheets("1")
is different than
worksheets(1)
 

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