Show Dependents

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Show Dependents

Post by Don Wells »

    When using the ActiveCell.ShowDependents command, there is an annoying beep when no dependents exist. I have not been able to mute the beep nor find any tests to determine if dependents exist -- which don't cause a beep on their own.
    Any ideas?

T.I.A.
Regards
Don

User avatar
HansV
Administrator
Posts: 78794
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Show Dependents

Post by HansV »

Try this:

Code: Select all

  Dim lngCount As Long
  On Error Resume Next
  lngCount = ActiveCell.Dependents.Count
  On Error GoTo 0
  If lngCount > 0 Then
    ActiveCell.ShowDependents
  End If
It will only work with dependents on the same sheet; if there are dependents on other sheets or in other workbooks, it becomes more complicated.
Best wishes,
Hans