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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top