VBA 强制转日期格式

1、强制转日期格式,yyyy-m-d

Sheet2.Cells(2, 1) = Format(Sheet2.Cells(2, 1), "yyyy-m-d")
Sheet2.Cells(2, 25) = Format(Sheet2.Cells(2, 25), "yyyy-m-d")

2、取日期格式中的年 、月。

Sheet2.Cells(2, 3) = Month(Sheet2.Cells(2, 1))
Sheet2.Cells(2, 2) = Year(Sheet2.Cells(2, 1))

原文地址:https://www.cnblogs.com/flyer2018/p/10127519.html