Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Excel VBA 中:
如何循环遍历给定日期范围内的所有日期?
'2013-01-01' 到 '2013-01-03' 应该给出:
2013-01-01 2013-01-02 2013-01-03
这至少应该向您展示如何开始您正在尝试做的事情:
Sub test() Dim StartDate As Date Dim EndDate As Date Dim DateLooper As Date StartDate = #1/1/2013# EndDate = #12/31/2013# For DateLooper = StartDate To EndDate MsgBox (DateLooper) Next DateLooper End Sub