Macro for changing tabs
Sub AddWeek1()
Dim N As Long
Dim sName As String
Dim sNum As String
With ThisWorkbook.Worksheets
For N = .Count To 1 Step -1
sName = .Item(N).Name
If LCase(Left(sName, 4)) = "week" Then
sNum = Right(sName, Len(sName) - 4)
If sNum = "1" Then itm = N
.Item(N).Name = "Week" & CLng(sNum) + 1
End If
Next N
.Add(befo=.Item(itm)).Name = "Week1"
End With
End Sub
It wasn't clear to me if you wanted similar functionality for the
TopStockWeek sheets. This just works on the Week Sheets.
--
Regards,
Tom Ogilvy
"Duncan J" wrote in message
...
Thanks Chip, However, It renames all my tabs week1 wee2 ect. and even
changes the Top stock tabs to week13 14 ect.
I tried tweaking it a bit but have not been able to get it to work. Here
are my tabs.
Chart Data Week1 Week2 Week3 Week4 Week5 Week6 Week7(Next week it will go
to Week8 and so on) Then Tabs
Topstockweek1 topstockweek2 topstockweek3 topstockweek4. ect
The code I have from you changed all but chart tab to "week" 1 2 3 4 5
ect..
Thanks for your time
DJ
|