マクロ
Sub test()
Dim ws As Worksheet
Dim inputDate As Date
Dim daysInMonth As Integer
Dim i As Integer
Dim cnt As Long
Set ws = ThisWorkbook.Sheets("複写")
inputDate = ws.Range("A1").Value
daysInMonth = Day(DateSerial(Year(inputDate), Month(inputDate) + 1, 0))
For i = 1 To daysInMonth
If (Weekday(DateSerial(Year(inputDate), Month(inputDate) + 1, i)) <> 7) And (Weekday(DateSerial(Year(inputDate), Month(inputDate) + 1, i)) <> 1) Then
Worksheets("複写").Copy Before:=Worksheets("複写")
ActiveSheet.Name = i
ActiveSheet.Range("A2").Value = DateSerial(Year(inputDate), Month(inputDate), i)
End If
Next i
cnt = Sheets.Count
Sheets(cnt).Move Before:=Sheets(1)
End Sub
この記事が気に入ったらサポートをしてみませんか?