|
試しに作ってみましたので、参考にして下さい。
Sub Sample()
Dim myYear As Long
Dim myMonth As Long
Dim myDay As Date
Dim i As Long
Columns("A").ClearContents
myYear = Application.InputBox("年を西暦4桁で入力して下さい。 例) 2003 ", Type:=1)
If Len(CStr(myYear)) <> 4 Then
MsgBox myYear & " : 入力が不正です。", 48
Exit Sub
End If
myMonth = Application.InputBox("月を2桁で入力して下さい。 例) 01 ", Type:=1)
If Len(CStr(myMonth)) <> 2 Then
MsgBox myMonth & " : 入力が不正です。", 48
Exit Sub
End If
i = 1
Do
myDay = CDate(myYear & "/" & myMonth & "/" & i)
If Format(myDay, "aaa") = "月" Or _
Format(myDay, "aaa") = "水" Or _
Format(myDay, "aaa") = "金" Then
Range("A65536").End(xlUp).Offset(1).Value = _
Format(myDay, "mm月dd日") & "(" & Format(myDay, "aaa") & ")"
End If
i = i + 1
If Day(myDay + 1) = 1 Then Exit Do
Loop
Range("A1").Value = "日付"
Columns("A").AutoFit
End Sub
|
|