1
我的標準是正確的,但第一個消息框從不顯示。我錯過了什麼?我沒有滿足什麼條件?
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而不是數字0. – sous2817
就是這樣。添加作爲答案我會更新帖子。再次感謝你的幫助。 –