I'm trying to loop through a column of Account Numbers in column D of a worksheet to check for any #N/A's. When I run this code I keep getting a type mismatch error on line 4:.
How do I fix this?
With Sheets("Sheet1")
lr = Cells(Rows.Count, "D").End(xlUp).row
For Each Cell In Range("D2:D" & lr)
If Cell.Value = CVErr(xlErrNA) Then
iViolations = iViolations + 1
End If
Next Cell
End With
How do I fix this?
With Sheets("Sheet1")
lr = Cells(Rows.Count, "D").End(xlUp).row
For Each Cell In Range("D2:D" & lr)
If Cell.Value = CVErr(xlErrNA) Then
iViolations = iViolations + 1
End If
Next Cell
End With