PC Review


Reply
Thread Tools Rate Thread

Direct Precedents of a cell

 
 
jdcox1999
Guest
Posts: n/a
 
      4th Oct 2006
I am writing a function (boolean) that tests if a cell is a direct
precedent of another cell. Any ideas? I am leaning towards using the
intersect of cell and direct precedents range null test as my
indicator.

Jeremy

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      4th Oct 2006
Sounds good, but there is a problem. It doesn't work.

DirectPrecedents seems to work differently in a User Defined Function.
Presumably, this is a function of the calculation
engine.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jdcox1999" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am writing a function (boolean) that tests if a cell is a direct
> precedent of another cell. Any ideas? I am leaning towards using the
> intersect of cell and direct precedents range null test as my
> indicator.
>
> Jeremy
>



 
Reply With Quote
 
jdcox1999
Guest
Posts: n/a
 
      4th Oct 2006
I get it to work from another sub but not from a worksheet cell (see
below). Any suggestions?


Sub testfunction()
Dim i As Boolean
i = IsDirectPrecedentOf(Range("BN45"), Range("BP45"))
MsgBox (i)
End Sub


Public Function IsDirectPrecedentOf(ByRef SubjectCell As Range, ByRef
ObjectCell As Range) As Boolean
IsDirectPrecedentOf = False
If Not Intersect(SubjectCell, ObjectCell.DirectPrecedents) Is Nothing
Then
IsDirectPrecedentOf = True
Else
IsDirectPrecedentOf = False
End If
End Function


Bob Phillips wrote:
> Sounds good, but there is a problem. It doesn't work.
>
> DirectPrecedents seems to work differently in a User Defined Function.
> Presumably, this is a function of the calculation
> engine.
>
> --
> HTH
>
> Bob Phillips
>


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      4th Oct 2006
It won't work from a worksheet as I explained, and I am afraid I don't
have a solution.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jdcox1999" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I get it to work from another sub but not from a worksheet cell (see
> below). Any suggestions?
>
>
> Sub testfunction()
> Dim i As Boolean
> i = IsDirectPrecedentOf(Range("BN45"), Range("BP45"))
> MsgBox (i)
> End Sub
>
>
> Public Function IsDirectPrecedentOf(ByRef SubjectCell As Range, ByRef
> ObjectCell As Range) As Boolean
> IsDirectPrecedentOf = False
> If Not Intersect(SubjectCell, ObjectCell.DirectPrecedents) Is Nothing
> Then
> IsDirectPrecedentOf = True
> Else
> IsDirectPrecedentOf = False
> End If
> End Function
>
>
> Bob Phillips wrote:
> > Sounds good, but there is a problem. It doesn't work.
> >
> > DirectPrecedents seems to work differently in a User Defined Function.
> > Presumably, this is a function of the calculation
> > engine.
> >
> > --
> > HTH
> >
> > Bob Phillips
> >

>



 
Reply With Quote
 
jdcox1999
Guest
Posts: n/a
 
      4th Oct 2006
We went with a text search on the string version of the range. Since
it will be limited in application this is ok. Anyways we use this
formula within conditional formatting. ie. we want to bold a cell if
it is a precedent of another. Using worksheet change routine works,
but we want to use ctrl+z. the string search works but is taxing on
the virtual memory when done in conditional formatting.



Function IsDirectPrecedentOf(subjectcell As Range, objectcell As Range)
As Boolean
IsDirectPrecedentOf = False
IsDirectPrecedentOf = InStr(1, objectcell.Formula,
subjectcell.Address(0, 0))
End Function

Bob Phillips wrote:
> It won't work from a worksheet as I explained, and I am afraid I don't
> have a solution.
>
> --
> HTH
>
> Bob Phillips
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
WorkSheet Cell Precedents? Ken Microsoft Excel Misc 4 8th Apr 2010 01:18 PM
How to direct to a cell from text Jon Microsoft Excel Misc 3 20th Nov 2008 04:47 PM
Find duplicate range or cell ref (as precedents) in a cell's formula - an example aztecbrainsurgeon@yahoo.com Microsoft Excel Programming 2 24th Feb 2007 04:08 AM
Cell Precedents =?Utf-8?B?S2F2YWw=?= Microsoft Excel Programming 2 5th Apr 2005 08:16 AM
Identify precedents to cell in/outside of activesheet Neil Bhandar Microsoft Excel Programming 1 3rd Mar 2004 01:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 AM.