Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
For Each c In Target.Cells
**If c.Value <> Empty Or c.Value = 0 Then
End If**
If c.Column = 11 Then
c.Offset(0, -1).Value = Now()
End If
Next c
End Sub
I have the above code working well except I am trying to add the bolded code to ignore any blank cells (could also be the option of ignoring 0 value cells, but not necessary).
Thanks
You seem to have your two arguments going in different ways, in that your lumping together
<> Empty
and=0
in the same test.At any rate, this makes the change if there's something in the cell besides 0 and, as a bonus, clears the change if it is empty or 0.
should work for blank cells.
At least it worked here.
As for ignoring the value 0, couldn't you just change the if clause to
if c.Value > 0
?