如何解释Excel VBA的时差?

时间:2015-09-03 19:58:47

标签: excel vba excel-vba

我的下面的宏对于我的时区完全正常,但它在另一个时区使用,比我提前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

0 个答案:

没有答案