Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Direct Precedents of a cell

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Direct Precedents of a cell

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" wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Direct Precedents of a cell

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Direct Precedents of a cell

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" wrote in message
oups.com...
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Direct Precedents of a cell

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
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
WorkSheet Cell Precedents? Ken Excel Discussion (Misc queries) 4 April 8th 10 01:18 PM
How to direct to a cell from text Jon Excel Discussion (Misc queries) 3 November 20th 08 04:47 PM
How do I direct cursor to a specific cell? Sandman Excel Discussion (Misc queries) 2 June 3rd 08 06:36 PM
Cell Precedents Kaval Excel Programming 2 April 5th 05 08:16 AM
Using Indirect en direct cell references Bart Schouw Excel Discussion (Misc queries) 2 January 13th 05 01:05 PM


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

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

About Us

"It's about Microsoft Excel"