求救:请各位帮忙在EXCEL里写一个宏,计算一个单元格距当前日期的年、月、日。在线等待…… 本人多年不用VB,忘了语法。举例如下:getdate(2002-5-2,2003-7-15)=1,2,13急急急!!!谢谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 求年月日Sub Macro1() Range("c3").Value = Year(Range("B3").Value) - Year(Date) '年 Range("c3").Value = Range("c3").Value & "," & Month(Range("B3").Value) - Month(Date) '月 Range("c3").Value = Range("c3").Value & "," & day(Range("B3").Value) - day(Date) '日 End Sub 你给B3单元格输入2002-5-2,然后运行,C3单元格应该是“1,2,14”。Sub Macro1() Range("c3").Value = Year(Date) - Year(Range("B3").Value) '年 Range("c3").Value = Range("c3").Value & "," & Month(Date) - Month(Range("B3").Value) '月 Range("c3").Value = Range("c3").Value & "," & Day(Date) - Day(Range("B3").Value) '日End Sub 有一个时间是段日期型的,改成这样Sub Macro1() Range("c3").Value = format(Year(Date),"yyyy") - format(Year(Range("B3").Value),"yyyy") '年 Range("c3").Value = Range("c3").Value & "," & Month(Date) - Month(Range("B3").Value) '月 Range("c3").Value = Range("c3").Value & "," & Day(Date) - Day(Range("B3").Value) '日End Sub 急,求教,如何用明天日期为文件名保存输入的文本文件 请教:如何获取2进制文件的记录数? 谁知道VB怎么制作绿色,即免安装的程序? 谁知道控件编程中的AccessKeys属性怎么用? (求救)这是我的第一个VB程序,请各位帮帮忙!!! 谁用过InitCommonControls函数? 对象和类的讨论。。 关于DAO重复定义字段出错的解决办法,请指教 怎样使TreeView控件里面的内容清空,初始化它。 控件不支持中文,可以解决吗? 请各位大哥帮小第一把,很简单的 treeview和listview如何使用其功能呢?
Sub Macro1()
Range("c3").Value = Year(Range("B3").Value) - Year(Date) '年
Range("c3").Value = Range("c3").Value & "," & Month(Range("B3").Value) - Month(Date) '月
Range("c3").Value = Range("c3").Value & "," & day(Range("B3").Value) - day(Date) '日
End Sub
Range("c3").Value = Year(Date) - Year(Range("B3").Value) '年
Range("c3").Value = Range("c3").Value & "," & Month(Date) - Month(Range("B3").Value) '月
Range("c3").Value = Range("c3").Value & "," & Day(Date) - Day(Range("B3").Value) '日
End Sub
Sub Macro1()
Range("c3").Value = format(Year(Date),"yyyy") - format(Year(Range("B3").Value),"yyyy") '年
Range("c3").Value = Range("c3").Value & "," & Month(Date) - Month(Range("B3").Value) '月
Range("c3").Value = Range("c3").Value & "," & Day(Date) - Day(Range("B3").Value) '日
End Sub