I am trying to create a code for checking filling color of the cells. If there is no color, code should continue forward. If there is a fill color then code should give an error.
I have an error handler, it is sending an email message on error:
On Error GoTo ErrorHandlerColor
ErrorHandlerColor:
Here is my code:
With ThisWorkbook.Worksheets("Main").Range("A2" & ThisWorkbook.Worksheets("Main").Range("L2").End(xlDown).Row)
If IsNull(.DisplayFormat.Interior.ColorIndex) Then
Else
MsgBox 1 / 0
Exit Sub
End If
End With
My range is actually something A2:L1343
, but as it is changing I am setting it till the last row.
By error I mean MsgBox 1 / 0
so logic does not work
Currently the problem is that it is giving an error all the time. Even if there are no cells with filling color. What can be possibly wrong?