エクセル形式の2016年1月~2016年12月のカレンダーです。
四半期は4月~6月を第1四半期としています。
コード
Sub calenddd()
Dim ws As Worksheet, i As Long
Dim firstDay As Date
'inputボックスに一日目を入力
firstDay = InputBox(Date, "最初の日", "YYYY/MM/DD")
Set ws = Worksheets(1)
With ws
For i = 2 To 367 'めんどいので余分にとっておく
If i <> 2 Then
.Cells(i, 1) = Format(.Cells(i - 1, 1) + 1, "YYYY/MM/DD")
Else
.Cells(i, 1) = Format(firstDay, "YYYY/MM/DD")
End If
'スラッシュない形式
.Cells(i, 2) = Format(.Cells(i, 1), "YYYYMMDD")
'曜日(略
.Cells(i, 3) = Format(.Cells(i, 1), "aaa")
'曜日(フル
.Cells(i, 4) = Format(.Cells(i, 1), "aaaa")
'Yobi(Ryaku
.Cells(i, 5) = Format(.Cells(i, 1), "ddd")
'Yobi(Full
.Cells(i, 6) = Format(.Cells(i, 1), "dddd")
'和暦
.Cells(i, 7) = Format(.Cells(i, 1), "ggg")
'年月
.Cells(i, 8) = Format(.Cells(i, 1), "YYYYMM")
If Format(.Cells(i, 1), "q") = 1 Then
'四半期
.Cells(i, 9) = 4 & "Q"
Else
'四半期
.Cells(i, 9) = Format(.Cells(i, 1), "q") - 1 & "Q"
End If
Next i
End With
End Sub
作成後のエクセルファイルはこちらです。
2016年カレンダー
参照・類似ページ
日付表示書式指定(Format)関数日付を取得する(Date)関数
年月日計算値(シリアル値)を取得する(DateSerial)関数