ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count Dependents (https://www.excelbanter.com/excel-programming/372469-count-dependents.html)

[email protected]

Count Dependents
 
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


Die_Another_Day

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




All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com