renaming worksheet tabs

W

william.healy

Problem: I'm using the INDIRECT function to lookup
information.

I want to mass update the names of 600 worksheets,
contained within 8 Excel Spreadsheets (each worksheet
contains information relating to the "customer account
number")

Any ideas how I can do this "short hand" - my VB skills
are "limited" at best!
 
B

Bob Phillips

Is the new name in a designated cell on each sheet? If so, you could simply
open all of the 8 workbooks in Excel, then use this code

For Each wb In Workbooks
For Each sh In wb.Worksheets
sh.Name = sh.Range("A1")
Next sh
Next wb


--

HTH

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

william.healy

Fantastic!

It may seem churlish, but anyway this can be worked from
a source table instead?
 
B

Bob Phillips

Do you mean like this

Set rngSheets = ActiveSheet.Range("A1:A600")
i = 1
For Each wb In Workbooks
For Each sh In wb.Worksheets
sh.Name = rngSheets(i, 1).Value
i = i + 1
Next sh
Next wb

--

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