用VB语法:TextBox输入20120212日期在EXCEL显示2月份的月初和月末格式为2012/2/1~2012/2/28 怎么写呢
1个回答
展开全部
Sub aa()
Dim top, last As String
t = Application.InputBox("请输入日期:", "日期输入窗口", Format(Date, "ddddd"), Type:=2)
top = DateSerial(Year(t), Month(t), 1)
last = DateSerial(Year(t), Month(t) + 1, 0)
Text = Year(top) & "/" & Month(top) & "/" & Day(top) & "~" & Year(last) & "/" & Month(last) & "/" & Day(last)
MsgBox Text
End Sub
Dim top, last As String
t = Application.InputBox("请输入日期:", "日期输入窗口", Format(Date, "ddddd"), Type:=2)
top = DateSerial(Year(t), Month(t), 1)
last = DateSerial(Year(t), Month(t) + 1, 0)
Text = Year(top) & "/" & Month(top) & "/" & Day(top) & "~" & Year(last) & "/" & Month(last) & "/" & Day(last)
MsgBox Text
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询