LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro for changing tabs

Sub AddTopStockWeek1()
Dim N As Long
Dim sName As String
Dim sNum As String
Dim itm As Long
With ThisWorkbook.Worksheets
For N = .Count To 1 Step -1
sName = .Item(N).Name
If LCase(Left(sName, 12)) = "topstockweek" Then
sNum = Right(sName, Len(sName) - 12)
If sNum = "1" Then itm = N
.Item(N).Name = "TopStockWeek" & CLng(sNum) + 1
End If
Next N
.Add(befo=.Item(itm)).Name = "TopStockWeek1"
End With

End Sub

Should work.

--
Regards,
Tom Ogilvy



"Duncan J" wrote in message
...
Thanks Tom,
That worked great. Could you do the same for Top Stock out week1
Thanks again.
DJ



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart tabs changing by themself Elardus Charts and Charting in Excel 4 February 12th 10 01:42 AM
Run Macro when changing tabs Supe Excel Discussion (Misc queries) 2 December 31st 08 10:51 PM
Changing the size of sheetname tabs Edward Excel Discussion (Misc queries) 7 October 10th 06 02:27 AM
Changing Tabs to Specific Cells Darren Excel Discussion (Misc queries) 2 November 10th 05 04:21 AM
Changing colors of tabs Christopher Anderson Excel Discussion (Misc queries) 2 November 29th 04 04:09 PM


All times are GMT +1. The time now is 05:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"