dealing with multiple named worksheets with one macro

R

Ray Morton

I want one macro to create a chart over a set the same amount of cells no matter what the worksheet or workbook is named. Is there some "activeworksheet" command that I can use in my code that will work no matter what the name is? So far the code is getting hung up on setting the source data with a specific worksheet name. any suggestion would be greatly appreiciated.
 
V

Vasant Nanavati

Hi Ray:

ActiveSheet

Regards,

Vasant.

Ray Morton said:
I want one macro to create a chart over a set the same amount of cells no
matter what the worksheet or workbook is named. Is there some
"activeworksheet" command that I can use in my code that will work no matter
what the name is? So far the code is getting hung up on setting the source
data with a specific worksheet name. any suggestion would be greatly
appreiciated.
 
R

Ray Morton

If I wanted to change this particular module:
Sheets("tanks006").select
Sheets("tanks006").name="tanks"

How would I go about doing this? I tried using activesheet and it didn't work. I want this name to be able to change to anything and still be able to change what ever it is to "Tanks"
 
T

Tom Ogilvy

If you want to select a particular sheet, you need to specify what the sheet
name is or some other way to identify it. ActiveSheet pertains to the
currently visible sheet.


Activesheet.Name = "tanks"

will name the activesheet tanks.

But the challenge is how to identify that it is tanks006 that you want to
rename. The question is how you would identify the sheet you want to
rename?

--
Regards,
Tom Ogilvy

Ray Morton said:
If I wanted to change this particular module:
Sheets("tanks006").select
Sheets("tanks006").name="tanks"

How would I go about doing this? I tried using activesheet and it didn't
work. I want this name to be able to change to anything and still be able to
change what ever it is to "Tanks"
 

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