Create and Name Worksheets using a Macro

ultracyclist

Active Member
Joined
Oct 6, 2010
Messages
268
Office Version
  1. 365
Platform
  1. Windows
I’m using the following macro to create additional worksheets with a set naming standard. I want to revise the macro to create worksheets using the following date format. The first worksheet name will be called 7-2-12. The next worksheet should be called 7-9-12, 7-16-12, etc. The first part of the macro works, just not sure how to adjust the line of code that starts with “Sheets"


</SPAN>
Code:
 </SPAN></SPAN>

Sub NameSheetsByWeekDay()
    Dim i As Integer, j As Integer
    Application.ScreenUpdating = False
    For i = 1 To 8
        For j = 1 To 5
            If i > 1 And j > 1 Then
                Sheets("WK1 DY1").Copy after:=Worksheets(Worksheets.Count)
                ActiveSheet.Name = "WK" & i & " DY" & j
                If i > 1 And j = 5 Then
                    Sheets("Week1 Summary").Copy after:=Worksheets(Worksheets.Count)
                    ActiveSheet.Name = "Week" & i & " Summary"
                End If
            End If
        Next j
    Next i
    Application.ScreenUpdating = True
End Sub
</SPAN>


Thanks,

Allen
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,196,027
Messages
6,012,948
Members
441,740
Latest member
abaz21

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
Top