Last active
January 30, 2023 07:31
-
-
Save Myoga1012/806f48d7eaed508ac678 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
' 名前 : Myoga Screw-bright (旧名:Myoga S. Tomonaka) | |
' Twitter : https://twitter.com/Myoga1012 | |
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 Myoga-TN.net All Rights Reserved. | |
' 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