此代码很旧,可能会有所改进。
如果有人认为他们可以为此功能生成更好的代码,请继续,并告诉我您的努力。 如果我觉得更好(更有效,
100%准确 ),然后我将其替换。在此之前,它至少是一个可用版本,供访客在需要时使用。
'MoveWD moves datThis on by the intInc weekdays.
Public Function MoveWD(datThis As Date, intInc As Integer) As Date
MoveWD = datThis
For intInc = intInc To Sgn(intInc) Step -Sgn(intInc)
MoveWD = MoveWD + Sgn(intInc)
Do While (Weekday(MoveWD) Mod 7) < 2
MoveWD = MoveWD + Sgn(intInc)
Loop
Next intInc
End Function
From: https://bytes.com/topic/access/insights/591016-function-move-forwards-backwards-through-weekdays
本文分享了一个VBA函数MoveWD,用于根据指定的增量在工作日之间向前或向后移动日期。该函数通过循环调整输入日期直到落在工作日上,实现日期在工作日之间的精确移动。作者邀请读者尝试改进代码,以提高效率和准确性。
1万+

被折叠的 条评论
为什么被折叠?



