vba VBA获取上一个工作日的日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43898970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VBA to get the date of the Previous Workday
提问by MMS
I am trying to get the Previous working day of today. Say if suppose today is Wednesday, then the previous working day will be Tueday but if today is Monday then the previous working day will be Friday. How do I get the date of the previous working day?
我正在尝试获取今天的上一个工作日。假设今天是星期三,那么前一个工作日将是星期二,但如果今天是星期一,那么前一个工作日将是星期五。如何获取前一个工作日的日期?
Thanks
谢谢
回答by Gary's Student
回答by SuShuang
It's worth to say that this function can handle also Public Holidays, but this argument is optional. So in fact we have:
值得一提的是,这个函数也可以处理公共假期,但这个参数是可选的。所以实际上我们有:
=WORKDAY(TODAY(),-1, 'Range with Public Holidays Dates')
for example:
例如:
=WORKDAY(TODAY(),-1, A1:A10)