0
我寫了一個循環,從另一個工作表的特定單元格中提取條件。這個條件自身很好,但是當我爲同一個數據集包含其他條件時,它會以某種方式將所有單元格標記爲不正確。下面是我寫的:具有多個條件的嵌套循環
rate_check = False
Do While sh_controls.Cells(j, 10) <> vbNullString
If sh_audit.Cells(i, 4) <= sh_controls.Range("c2") And sh_controls.Cells(j, 10) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Best Efforts" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) >= sh_controls.Range("c2") And sh_controls.Cells(j, 10) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Mandatory" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) <= sh_controls.Range("c3") And sh_controls.Cells(j, 10) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Mandatory" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) >= sh_controls.Range("c3") And sh_controls.Cells(j, 10) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Best Efforts" Then
rate_check = True
End If
If sh_audit.Cells(i, 4) >= sh_controls.Range("e2") And sh_controls.Cells(j, 11) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Best Efforts" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) <= sh_controls.Range("e2") And sh_controls.Cells(j, 11) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Mandatory" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) >= sh_controls.Range("e3") And sh_controls.Cells(j, 11) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Mandatory" Then
rate_check = True
ElseIf sh_audit.Cells(i, 4) <= sh_controls.Range("e3") And sh_controls.Cells(j, 11) = sh_audit.Cells(i, 8) And sh_audit.Cells(i, 9) = "Best Efforts" Then
rate_check = True
End If
這似乎是重疊在同一個數據集的條件...任何想法!!! ???
這將幫助,如果你粘貼到你的問題,數據的一些截圖,也如果你給我們多一點你的代碼 - 例如如何計算'i'和'j'。 – YowE3K