variables总是返回为False

我是VBA新手,可能有一个简单的解决scheme来解决这个问题。 我写了下面的代码,但无论如何,variablesjan总是返回false。

Dim month1 As Integer Dim month2 As Integer Dim month3 As Integer Dim month4 As Integer Dim jan As Boolean If Not IsEmpty(Sheet1.[K29]) Then month1 = month(Sheet1.[K29]) If Not IsEmpty(Sheet1.[K30]) Then month2 = month(Sheet1.[K30]) If Not IsEmpty(Sheet1.[K31]) Then month3 = month(Sheet1.[K31]) If Not IsEmpty(Sheet1.[K32]) Then month4 = month(Sheet1.[K32]) If month1 > 1 Or month2 > 1 Or month3 > 1 Or month4 > 1 Then jan = False 

我已经单独testing了variablesmonth1,month2等,除了最后的条件外,一切似乎都很好。 即使所有variables= 1,jan仍然是错误的。

思考?

也许你可以尝试这样的…

 If month1 > 1 Or month2 > 1 Or month3 > 1 Or month4 > 1 Then jan = False Else jan = True End If