用excelvba写的日历部分代码如下PrivateSubCalendar(ByValiyear,ByValimonth)Foricol=1To7Forirow=3To8Cells(irow,icol)=""NextNextiday=DateSerial(iyear,imonth,1)'获得相应年月第一天的日期irow=3icol=Weekday(iday)'计算该天是星期几DoCells(irow,icol)=Day(iday)'在单元格填入日期IfWeekday(iday)=vbSaturdayThen'星期六则的换行irow=irow+1icol=1Elseicol=icol+1EndIfiday=DateAdd("d",1,iday)'日期递增LoopWhile(Day(iday))<>1EndSub
1