Add worksheets

Maheshp

Board Regular
Joined
Jul 29, 2009
Messages
186
Hi
My Activesheet Name is Apr-09, i want to copy the same sheet 11 times & rename it as form May-09 till Mar-10, Date range is Financial year.
how can i do it with vb code, i will appreciate any help on this.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try

Code:
Sub test()
Dim d As Date, i As Long
With ActiveSheet
    d = DateValue("01-" & .Name)
    For i = 1 To 11
        .Copy after:=Worksheets(Worksheets.Count)
        ActiveSheet.Name = Format(DateAdd("m", i, d), "mmm-yy")
    Next i
End With
End Sub
 
Upvote 0
I think this will do what you asked for...
Code:
Sub AddDatedSheetNames()
  Dim X As Long, NextSheetName As String
  Worksheets("Apr-09").Activate
  For X = 1 To 11
    NextSheetName = Format(DateAdd("m", 1, CDate("28-" & ActiveSheet.Name)), "mmm-yy")
    ActiveSheet.Copy After:=ActiveSheet
    ActiveSheet.Name = NextSheetName
  Next
End Sub
 
Upvote 0


Thanks VoG
<MARQUEE>:bow:</MARQUEE>
As usual it’s amazing, thank you !
<MARQUEE>:) :):)</MARQUEE>

Thanks Rick
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top