我希望实现的功能是:
一个下拉菜单,菜单里的选项是本年本月每天的日期。若本月为1月,则下拉菜单的内容是从2003-1-1,2003-1-2……2003-1-31,若本月为4月,则下拉菜单内容是2003-4-1,2003-4-2……2003-4-30。请问这个功能要用什么方法实现呢?
一个下拉菜单,菜单里的选项是本年本月每天的日期。若本月为1月,则下拉菜单的内容是从2003-1-1,2003-1-2……2003-1-31,若本月为4月,则下拉菜单内容是2003-4-1,2003-4-2……2003-4-30。请问这个功能要用什么方法实现呢?
先建一个31个键的菜单。设为menuchild(1 to 31)
month获得当前的月份
循环判断
如果是时间就menuchild(i)=时间
menuchild(i).visible=true
Dim tran_date
With Worksheets("sheet1")
for i=1 to 31
tran_date=year(now()) & "-" & month(now()) & "-" & i
if (IsDate(tran_date)) Then
.Range("A1") = tran_date
End If
Next i
End With