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