[英]VBA checking cell interior color
我正在尝试根据电池的内部颜色进行操作。
到目前为止,这是我的代码,但是在If行上显示错误。
For i = 3 To dumpLastRow
With masterFile.Sheets(dumpRef)
If .Range("A", i).Interior.ColorIndex = 4 Then
''''CODE''''
Else
''''CODE''''
End If
End With
Next
如果您有任何想法,将不胜感激。 谢谢
作为替代,此版本可能更易于使用
With masterFile.Sheets(dumpRef)
Dim cell As Range
For Each cell In .Range("A3:A" & dumpLastRow).Cells
If cell.Interior.ColorIndex = 4 Then
''''CODE''''
Else
''''CODE''''
End If
Next
End With
您不能在范围内组合字母和数字。 请改用单元格。 您需要两次放入单元格,这是Range在使用cells
进行填充时要求的。
Range(Cells(i, 1), Cells(i, 1)).Interior.ColorIndex
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.