Excel设计的日历。打开显示当前的时间和本年的日历。通过上下两个按钮可以切换年份。按下为递减一年,按上显示增加一年的日历。周末显示为红色哦。
作者:Excel小子-Office中国Excel日历操作动画
1481962510130115.gif
Excel日历详细VBA代码: Private Sub SpinButton1_Change() Cells(1, 2) = SpinButton1.ValueEnd Sub Private Sub SpinButton2_Change() Cells(1, 5) = SpinButton2.ValueEnd Sub Sub newti() newtimeEnd SubSub riqi()Application.EnableEvents = False Dim arr() Dim i Dim t Dim ar, a Dim x, y, j Dim first_day_weekday Dim last_day 'arr = Range("a3:g8") For y = 1 To 4 For x = 1 To 3 j = j + 1 first_day_weekday = Weekday(DateSerial([b1], j, 1), vbSunday) last_day = Day(DateSerial([b1], j + 1, 0)) 'Debug.Print DateSerial([b1], [e1] + 1, 0) 'Stop ReDim arr(1 To 6, 1 To 7) For i = 1 To 6 For t = 1 To 7 ar = ar + 1 If first_day_weekday |