-
-
Save Nia-TN1012/bf5a19a2502d0280fa077d5027a4b211 to your computer and use it in GitHub Desktop.
Excelのワークシートにカレンダー出力するVBAのモジュールです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 名前 : 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GitHubのアカウント統合のため、Myoga1012→Nia-TN1012に移行しました。
旧URL: https://gist.github.com/Myoga1012/806f48d7eaed508ac678