View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to traverse cell.Dependents

I have no idea why it doesn't work.

But if you put a watch on that variable and then step through the code, you'll
see that alldeps doesn't become nothing.



joeu2004 wrote:

On Feb 14, 6:52 pm, Dave Peterson wrote:
Dim AllDeps As Range
[....]
Set AllDeps = Nothing
On Error Resume Next
Set AllDeps = Cell.Dependents
On Error GoTo 0
If AllDeps Is Nothing Then


Thanks. I have verified the need for all the elements of your
solution. But I'm still puzzled. If we can set a Range variable
(AllDeps) to Nothing, and if we can test a Range variable (AllDeps)
for "is nothing", why can't we test a property that returns a Range
object (Dependents) for "is nothing" directly?

I know the following does not work:

If cell.Dependents is Nothing Then

But I don't understand why not. If a property returns a Range object,
why doesn't it return Nothing, which seems to be a (null) Range
object, since it can be assigned to a Range variable without error.
(I cannot find an explanation of Nothing.)


--

Dave Peterson