Skip to content

Instantly share code, notes, and snippets.

@Myoga1012
Last active January 30, 2023 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Myoga1012/806f48d7eaed508ac678 to your computer and use it in GitHub Desktop.
Save Myoga1012/806f48d7eaed508ac678 to your computer and use it in GitHub Desktop.
Excelのワークシートにカレンダー出力するVBAのモジュールです。
' 名前 : 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