如何计算Excel VBA中的时差?

我有下面的macros对我的时区非常好,但它在另一个时区,以及我的13小时。 无论如何说明这一点? 或一个if / else条件来运行一个不同的代码取决于现在的时间?

'This part of the macro will use system time to determine the day and run a different version of the macro depending on the result If Weekday(Now()) = vbFriday Then 'Delete any row that has a cutoff date of further than 3 day from current time (Friday) Last = Cells(Rows.Count, iDateColumn).End(xlUp).Row For i = Last To 2 Step -1 If (Cells(i, iDateColumn).Value) > (Now + 3) Then Cells(i, iDateColumn).EntireRow.Delete End If Next Else 'Delete any row that has a cutoff date of further than 1 day from current time (Mon-Thurs) Last = Cells(Rows.Count, iDateColumn).End(xlUp).Row For i = Last To 2 Step -1 If (Cells(i, iDateColumn).Value) > (Now + 1) Then Cells(i, iDateColumn).EntireRow.Delete End If Next End If 

SO上复制了这个问题的答案。

VBA不提供这样做的function,但Windows API。 幸运的是,您也可以使用VBA中的所有function。 本页介绍如何做到这一点:

时区和夏时制