DirectDependents not working properly.

B

baobob

I am having extreme difficulty determining if a cell has dependents:

Function CellA1HasDependents()
Dim R As Range
Set R = Range("MySheet!A1").DirectDependents
if R Is Nothing then
...

Whether another cell (on MySheet) refers to A1 or NOT, R is always Not
Nothing.

What am I doing wrong?

Thanks.

***
 
B

baobob

My difficulties and confusion increase, not decrease.

If A1 has 1+ dependents, then if in the VBE Immediate window I type
Range("MySheet!A1").DirectDependents.Count, I get a correct answer.

But:

1) If A1 has no dependents, then the expression throws an error (1004)
instead of answering "0". Why?

2) When the same expression is used in my FUNCTION, then, whether A1
has dependents or not, it a) always produces spurious value 1, and b)
never throws an error.

What is all this illogical behavior?

Thanks.

***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top