View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Tab Naming Macro problem - help needed

Hi,

I'm not sure I fully inderstand the bit aboutchanging the order of names
which makes things very difficult because in the renaming process it is
likely you would try and have 2 sheets with the same name which is illegal.
To get around this the macro forst renames the shet 1,2,3 etc and then
renames them using a list in column A

I've included no error trapping for not enough sheets for example



Sub sonic()
For x = 1 To ThisWorkbook.Worksheets.Count
Worksheets(x).Name = x
Next
y = 1
For x = 1 To ThisWorkbook.Worksheets.Count Step 2
Worksheets(x).Name = Sheets(1).Cells(y, 1).Value
Worksheets(x + 1).Name = Sheets(1).Cells(y, 1).Value & " Graph"
y = y + 1
Next
End Sub

Mike

"James" wrote:

Hi all,

I have a list of people names (approx 20) that I would like to use to name
separate tabs in a spreadsheet. For each person, I need two named tabs (one
has all the calculated data and the other has a graph of selected
information). I need to set up a macro that automatically takes the names
from the list and renames the tabs accordingly.

If I was to reorder the list or add new names, the macro needs to
automatically update itself and rename the associated tabs.

For example:

A1: Bob
A2: Joe
A3: Gary etc etc

Two tabs required for each (1st: same as A1, 2nd: A1 graph) and so on. If
A1 was to change to Jim and A4 was added for Bob, the tabs need to reflect
this change.

Hope this makes sense.

Can anyone help?

Thanks

James
--
J