Skip to content

Instantly share code, notes, and snippets.

@Nia-TN1012
Forked from Myoga1012/Calendar.vb
Last active January 30, 2023 07:33
Show Gist options
  • Save Nia-TN1012/bf5a19a2502d0280fa077d5027a4b211 to your computer and use it in GitHub Desktop.
Save Nia-TN1012/bf5a19a2502d0280fa077d5027a4b211 to your computer and use it in GitHub Desktop.
Excelのワークシートにカレンダー出力するVBAのモジュールです。
' 名前 : Nia Tomonaka
' Twitter : https://twitter.com/nia_tn1012
Sub Calendar()
Dim now As Date
now = Date
Dim iday As Date
iday = DateSerial(Year(now), Month(now), 1)
Dim seq As Integer
seq = Weekday(iday) - 1
Range("A1", "A6").Font.ColorIndex = 3
Range("G1", "G6").Font.ColorIndex = 5
Do
Cells(seq \ 7 + 1, seq Mod 7 + 1).Value = day(iday)
iday = DateAdd("D", 1, iday)
seq = seq + 1
Loop While Month(iday) = Month(now)
End Sub
' Calender.vb ( ExcelのVBA用 )
' Copyright (c) 2014-2023 Nia T.N. Tech Lab. / Chronoir.net.
' This software is released under the MIT License.
' http://opensource.org/licenses/mit-license.php
@Nia-TN1012
Copy link
Author

GitHubのアカウント統合のため、Myoga1012→Nia-TN1012に移行しました。

旧URL: https://gist.github.com/Myoga1012/806f48d7eaed508ac678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment