View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default Rename existing tabs

Yes

"Dawn Rhoads" wrote:

Oh that's beautiful, that works like a charm, thank you! When I have to
change the year, do I just change the number "2005" in both places in the
code to the current year?

Thanks again for your help!

"Alok" wrote:

This should do it

Sub Test2()
Dim i%
Dim m As Variant
m = InputBox("Enter Month Number Jan=1, Feb=2..", "Month")
If m = "" Then Exit Sub
For i = Day(DateSerial(2005, Val(m) + 1, 0)) To 1 Step -1
Worksheets("Master").Copy After:=Worksheets(1)
ActiveSheet.Name = Format(DateSerial(2005, Val(m), i), "mm-dd-yy")
Next i
End Sub

Alok Joshi

"Dawn Rhoads" wrote:

Thanks Alok! This is pretty close to what I need, and is actually better
than what I was thinking in that it creates all 31 sheets each time, which
will make it easier if I have to update the format of the sheet. Cool!

The only thing I would like differently is for the tab names not to be just
numbered 1-31. I would like them to be the actual dates. 5-1-05, 5-2-05,
etc. If this is too complicated, I do think just using the numbers 1-31
will be acceptable. But if you have an idea on how to get the actual date
onto each tab, that would be great.

Thanks for your help!

"Alok" wrote:

What I understand is that you have a workbook which has a worksheet called
Master and you want to copy that Master worksheet 30/31 times and rename each
with a Date. For instance the first tab as 1, the second tab as 2 and so on.
If this is what you require then the following will do it

Sub Test()
Dim i%
For i = 31 To 1 Step -1
Worksheets("Master").Copy After:=Worksheets(1)
ActiveSheet.Name = i
Next i
End Sub

After it does the creation of the sheets, manually delete the tabs not
required.

Alok Joshi
"Dawn Rhoads" wrote:

I have a monthly worksheet that requires one worksheet tab for each day.
Every month, I take my master sheet and manually rename each tab for the next
month.

Is there any way this could be done with a macro? If so, can someone
provide sample code? I have some experience with recording macros for Word,
but I'm definitely no programmer, so I can't actually write one myself!
Thanks for any help anyone can provide!