Renaming Workbooks

S

SMonczka

I have designed a macro that relies on references to various pages in
the spreadsheet and other spreadsheets. But if I rename any of the
other pages or spreadsheets then, of course the macro does not work.
Is there any way remedy this either automatically or through the use
of a global replace?

What I am doing is using a template for several account reps to add
data to. The template is renamed to the name of the account rep.
This data is then gathered by the account manager using another
spreadsheet. If I change the name of the template to the account rep,
I not only mess up the macro in the template but I loose the links
from the manager's spreadsheet to the template.

Any ideas?

Thanks
Steve
 
B

Bob Phillips

Steve,

In your macro, use the Codename property rather than the sheet name. The
code name is the name that you can see in the project explorer that is not
in brackets. You would use like

Sheet1.Range("A1")

rather than

Worksheets("Sheet1").Range("A1")



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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