|
こんなのでは?
Option Explicit
Public Sub Test_2()
Dim i As Long
Dim vntMark As Variant
vntMark = Application.InputBox("年月を2010/8の形で入力して下さい")
If VarType(vntMark) = vbBoolean Then
Exit Sub
End If
If Not IsDate(vntMark) Then
MsgBox "年月が所定の形では有りません", vbInformation
Exit Sub
End If
vntMark = DateValue(vntMark)
vntMark = DateSerial(Year(vntMark), Month(vntMark), 1)
For i = 1 To Day(DateSerial(Year(vntMark), Month(vntMark) + 1, 0))
Sheets("sheet1").Copy after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = i & "日"
Cells(1, 2).Value = Format(vntMark + i - 1, "aaaa")
Cells(1, 1).Value = i & "日"
Next i
End Sub
|
|