What is the function of
If Target.Cells.Count > 1 then
Exit sub
End If
and is it necessary as the first test in a Worksheet_Change(ByValue as
Range) sub?
Hi
Depends what you are doing. If you want the worksheet_change to
trigger when the value in one cell changes, then you need to check
that more than one cell did not change i.e. other cells you are not
bothered about.
quite often you will see
if intersect(myRange, Target).Count>1 then
Exit Sub
End if
so you only want one cell within the range myRange to trigger the
change (note .Cells is not required)
You will also see variants of
Set Testrange = intersect(myRange, Target)
if not Testrange is nothing then
if Testrange.count = 1 then
'do something
else
Exit Sub
end If
End if
So you are checking that Target is within a certain range AND that it
is only one cell, before change is triggered.
Target can be more than one cell though (e.g. a sum of cell values
reaching a value triggers change).
regards
Paul