Inherited a macro that flags order rows with a zero quantity, and it flagged every blank row too. The check was If ws.Cells(r, 4).Value = 0 Then. A blank cell hands back a Variant holding Empty, and Empty compares equal to 0 (and to "", if you write the other check, so you can't win that way either). Nobody had declared anything, naturally, so the whole macro ran on Variants and the comparison just did what Variants do.
The quick fix is IsEmpty before the comparison. Fine. But it made me count how many ways a VBA value can mean "nothing here". Empty from a blank cell, Null from an Access field, Nothing for an object variable, "", 0, and an error value if the cell shows #N/A. Six spellings, and each needs a different test.
How do you all model "no value" in VBA? Convert at the edge into typed variables and a flag, or keep Variants and test with VarType everywhere?