Automate naming of tabs

T

Tee

In Excel 2002 XP I have a workbook with 13 spreadsheets. I need t
automate the naming of the tabs on each spreadsheet so that eac
spreadsheet assumes the name of the contents of cell P1 for tha
respective spreadsheet. For instance, if the contents of cell P1 ar
1999, the tab needs to be 1999. If the contents of cell P1 are change
to 2000, I need the tab to be 2000.

I cannot use asap-utilities due to company regulations.

Any ideas? Thanks
 
F

Frank Kabel

Hi
put the following code in your worksheet module:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("P1")) Is Nothing Then Exit
Sub
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo errhandler
Application.EnableEvents = False
Me.Name = Target.Value

errhandler:
Application.EnableEvents = True
End Sub
 

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