全部,
我编写了以下代码来检查变量范围内的单元格是否具有条件格式。然而,代码落在"如果Cells.ColorIndex = 3那么"任何人都可以建议为什么错误发生,如果有一个比下面的代码更好的解决方案来实现循环通过cols&行(可变长度)
Sub Check_Conditional()
Dim rng As Range
Dim row As Range
Dim cell As Range
Dim RW As Long
RW = ActiveSheet.Range("Total").Offset(rowOffset:=-1).row
Set rng = Range("O7:AB" & RW)
For Each row In rng.Rows
For Each cell In row.Cells
If Cells.ColorIndex = 3 Then
MsgBox "Not all the cells have been filled out"
Exit For
End If
Next cell
Next row
End Sub