+ Reply to Thread
Results 1 to 5 of 5

Dates Across Multiple Worksheets and Worksheets Title with Dates

Hybrid View

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Dates Across Multiple Worksheets and Worksheets Title with Dates

    Hello,

    I'm looking to create separate worksheets for 52 different work weeks starting July 1, 2013. Each worksheet will have Monday-Saturday columns for scheduling.
    1. Is there a quick way to get each worksheet's name to be that of the Monday start date?
    2. Is there a quick way to have the dates for each week after week one auto-fill?

    I've done some searching, but come up empty on a solution that fills both criteria. These will save me a ton of time if possible. Much obliged for any suggestions provided.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Dates Across Multiple Worksheets and Worksheets Title with Dates

    ohthehorror,

    Welcome to the forum!
    Give this a try:
    Sub tgr()
        
        Dim ws As Worksheet
        Dim dtIndex As Date
        Dim i As Long
        
        dtIndex = CDate("July 1, 2013")
        
        For i = 1 To 52
            Set ws = Sheets.Add(After:=Sheets(Sheets.Count))
            With ws
                .Name = Format(dtIndex, "mmm dd, yyyy")
                With .Range("B1:G1")
                    .Value = Array(dtIndex, dtIndex + 1, dtIndex + 2, dtIndex + 3, dtIndex + 4, dtIndex + 5)
                    .NumberFormat = "dddd - mmm dd, yyyy"
                    .Font.Bold = True
                    .HorizontalAlignment = xlCenter
                    .Borders(xlEdgeBottom).LineStyle = xlContinuous
                    .ColumnWidth = 25
                End With
            End With
            dtIndex = dtIndex + 7
        Next i
        
        Set ws = Nothing
        
    End Sub
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    01-18-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Re: Dates Across Multiple Worksheets and Worksheets Title with Dates

    Thanks tiger. If nothing else this will save a lot of time.
    I probably should have mentioned this in the original questions, but is there anyway to apply the layout and format from the master sheet to the created 52 sheets?
    Again, thank you for any help.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Dates Across Multiple Worksheets and Worksheets Title with Dates

    Hi, ohthehorror,

    instead of adding a new sheet like
    Set ws = Sheets.Add(After:=Sheets(Sheets.Count))
    try copying the Master-Sheet
    Sheets("Master").Copy After:=Sheets(Sheets.Count)
    Set ws = ActiveSheet
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    01-18-2013
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Re: Dates Across Multiple Worksheets and Worksheets Title with Dates

    Holger,

    That worked splendidly, thanks a billion to both of you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1