Thread: rename tabs
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default rename tabs

May,

Try something like the following:

Sub NameSheets()
Dim Ndx As Long
Dim StartMonth As Variant
StartMonth = Application.InputBox(Prompt:="Enter the month number.",
Type:=1)
If StartMonth = False Then
Exit Sub
End If
For Ndx = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Worksheets(Ndx).Name = Format(DateSerial( _
IIf(StartMonth = 1, Year(Now) + 1, Year(Now)), StartMonth, Ndx), _
"dd.mm.yy")
Next Ndx
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"May" wrote in message
...
hi,

I have a spreadsheet containing 30 tabs--named according to the date such
as
01.02.07, 02.02.07....28.02.07. However, it will be painful to manualy
change
the name of them into 01.03.07, 02.03.07 for the next month. Is there an
easy
way to do it by using VBA?

Thanks for any help in advance.