Excel help - renami...
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

[Closed] Excel help - renaming worksheet tabs after a dates in cell

3 Posts
4 Users
0 Reactions
106 Views
Posts: 0
Free Member
Topic starter
 

Hi

I have a workbook which contains 52 worksheets, 1 per week, for a whole year, 1 week = 1 sheet.
Each sheet has a title for the week ending date.
I would like to avoid having to manually change the name on each sheet.
Is it possible to link the name of each sheet with the title cell on the worksheet, so the tabs along the bottom clearly show the corresponding week?
Many thanks.


 
Posted : 28/11/2011 2:31 pm
 5lab
Posts: 7922
Free Member
 

excel macro would be able to do this.


 
Posted : 28/11/2011 2:39 pm
Posts: 0
Free Member
 

Sub dothis()
For i = 1 To Sheets.Count
Sheets(i).Name = Worksheets(i).Range("A1").Value
Next
End Sub

Should work: Change A1 to your title cell.

You might want to add some code to check for Null values


 
Posted : 28/11/2011 2:47 pm
Posts: 0
Full Member
 

Yup VBA wil cure this. You'll need to amke a cell in one of your sheets the referance cell so the code can pick it up.
Do something in each tab "right click, view code"

Sub changetabname()
Dim WsName As String

With ActiveSheet
WsName = .Name
End With

' or this >> Sheets("Sheet1").Name = Left$(Sheets("Sheet1").Range("A1").Value,12)

* or this >> Sheets(WsName).Name = "add your report name here"

End Sub

Note, where Range("A1") = the cell referance where you want to pick up the tab name from, could be anywhere, but you mentioned dates, could be a good cell ref for the date, but you choose that

End (help!! haahahahaah)


 
Posted : 28/11/2011 2:51 pm