View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Count Dependents

You don't need to in this case:
MsgBox Selection.Dependents.Count

Charles
wrote:
I want my Sub to count the number of cells that depend from the range
that is currently selected. I wrote the following code, but it does not
work. How can I set a range to be equal to the current selection?

Sub Test_Dependents()

Dim r As Range

Set r = ThisWorkbook.ActiveSheet.Selection
MsgBox (r.Dependents.Count)

End Sub

Thank you

Caezar