Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding when there are no directdependents

Hi all,

I have made a macro to perform an operation on all cells that
dependents of a specified cell. I want to exit the macro when the
specified cell has no dependents. Whatever I try causes an error.
Please could you give me some ideas how to achieve this effect? Here's
an example of what I tried:

If masterCell.DirectDependents.Count = 0 Then
Exit Sub
End If

but even the count property is invalid when the cell has no
directdependents.


Thanks, smu

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Finding when there are no directdependents

Giive this a whirl...

Sub test()
Dim MasterCell As Range
Dim rng As Range

Set MasterCell = Range("A1")
On Error Resume Next
Set rng = MasterCell.DirectDependents
On Error GoTo 0
If rng Is Nothing Then
MsgBox "No Dependants"
Else
MsgBox rng.Address
End If

End Sub


--
HTH...

Jim Thomlinson


" wrote:

Hi all,

I have made a macro to perform an operation on all cells that
dependents of a specified cell. I want to exit the macro when the
specified cell has no dependents. Whatever I try causes an error.
Please could you give me some ideas how to achieve this effect? Here's
an example of what I tried:

If masterCell.DirectDependents.Count = 0 Then
Exit Sub
End If

but even the count property is invalid when the cell has no
directdependents.


Thanks, smu


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Same Row Value JN[_6_] Excel Programming 4 May 26th 06 04:43 PM
Finding last used mikefranklin1969 Excel Worksheet Functions 1 May 12th 06 10:05 PM
Finding a value dok112[_35_] Excel Programming 1 June 17th 05 09:17 PM
Finding Last Row Clint[_4_] Excel Programming 1 July 23rd 04 03:05 PM
Finding a sum Realwoodies Excel Programming 3 February 25th 04 11:46 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"