MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Testing for existance of cell dependents for if


Posted by Charles Nilsen on October 03, 2001 10:51 AM

I Am trying to set up a script to do some formatting changes to a cells dependent, if it has any. My script works great if a cell has dependents, but if it does not it blows up. Anyone know how to see if a cell has a dependent?

Thanks!

Chuck Nilsen


Posted by Barrie Davidson on October 03, 2001 11:03 AM

Chuck, you could use something like this.

On Error Resume Next
If ActiveCell.Dependents Is Empty Then
Exit Sub
Else
'your code goes here
End If

Regards,
Barrie
Barrie Davidson

Posted by Mark W. on October 03, 2001 11:27 AM

Select your cell then choose the
Edit | Go To... | Special... menu command,
click on the "Dependant" and the "Direct only"
or "All levels" radio buttons, and press [ OK ].