Create a Month's Sheets automatically

  • Thread starter Thread starter PumaMan
  • Start date Start date
P

PumaMan

I was wondering if there's a procedure to automatically add sheets for the
days in a month automatically? The format just needs the month and day, but
I'd like to be able to do it with VBA.

Thanks!
 
Option Explicit
Sub AddSheets()
Dim mn As Long
Dim dy As Date
Dim ws As Worksheet
Do
mn = InputBox("Enter Month (0 to quit)")
Loop Until mn >= 0 And mn <= 13

If mn = 0 Then Exit Sub

For dy = DateSerial(Year(Date), mn, 1) To DateSerial(Year(Date), mn + 1,
0)
Set ws = Worksheets.Add(after:=Worksheets(Worksheets.Count))
ws.Name = Format$(dy, "DD_MMM")
Next
End Sub
 
Back
Top