我的标准是正确的,但第一个消息框永远不会显示。我错过了什么?
Sub Crr_Premiums()
Dim LastRow As Long
Dim wb1 As Workbook
Dim i As Long
Set wb1 = Workbooks("macro all client v.01.xlsm")
LastRow = wb1.Sheets("CGIBill").range("A:A").Find("Overall - Total", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For i = 21 To LastRow
If wb1.Sheets("CGIBill").Cells(i, 16) > "0" And wb1.Sheets("CGIBill").Cells(i, 17) = "0.00" Then
MsgBox 1
Else
MsgBox 2
End If
Next i
End Sub
答案 0 :(得分:2)
“0”和0之间存在差异。用引号括起的一个是检查字符“0”。没有引号的那个正在寻找0的数值。删除引号,你应该是好的。