Aha, your cells in AP contain errors.
So we either need to handle that in the code, or change your formulas in AP.
Code:
Sub foo()
Dim ws As Worksheet
Dim lRow As Long
For Each ws In ThisWorkbook.Worksheets
For lRow = 9 To 19 Step 2
If Not IsError(ws.Cells(lRow, "AP")) Then
If ws.Cells(lRow, "AP").Value = 1 Then ws.Cells(lRow, "O").ClearContents
End If
Next lRow
Next ws
End Sub
Formula:
Formula:
=IFERROR(IF((AN9-AO9)>(1/86400),1,""),"")
Change one, or the other, or both, then you'll achieve what you want.
Bookmarks