當前位置:成語大全網 - 新華字典 - EXCELVBA如何實現多條件判斷,自動備註判斷的結果,結果正確就pass結果不正確就報警提示在線等急求代碼

EXCELVBA如何實現多條件判斷,自動備註判斷的結果,結果正確就pass結果不正確就報警提示在線等急求代碼

Sub 判斷()

Dim int2 As Integer

For int1 = 2 To Range("A65536").End(xlUp).Row

If Cells(int1, 1).Value = Cells(int1, 3).Value And Cells(int1, 2).Value = Cells(int1, 4).Value Then

With Cells(int1, 5)

.Value = "pass"

.Interior.ColorIndex = 3

.Font.Color = 1

.HorizontalAlignment = xlCenter

End With

Else

With Cells(int1, 5)

.Select

.Value = "錯誤"

.HorizontalAlignment = xlCenter

End With

MsgBox "該行存在不匹配數據", vbCritical, "錯誤提示"

Exit Sub

End If

Next int1

End Sub

抱歉這個問題我在手機上面看到的早,但是編寫代碼需要測試,而我不在家沒有電腦,手機沒法測試,壹直拖到現在,也不知道您的問題解決掉了沒有。

不知道您的具體情況,暫時寫了這樣的代碼您試試是不是您想要的效果,有什麽問題再討論,祝您工作順利,希望我的回答能幫到您!