View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Position of a Shape

I was surprised at that too. However, using Tom's NavigateArrow property (a
new one for me), I have devised a function that appears to work and which
matches the request from your original posting; namely, a simple function
that returns a Boolean indicating whether a cell has Precedent Tracing
turned on or not...

Function IsTracePrecedent(R As Range) As Boolean
Dim StartAddress As String
StartAddress = ActiveCell.Address
If R.HasFormula Then
IsTracePrecedent = R.NavigateArrow(True, 1).Address < R.Address
End If
Range(StartAddress).Select
End Function

I included the StartAddress stuff so you would not be left in "no man's
land" as the code navigated the arrow, choosing to return you to the active
cell before the function was called.

Also note the function assumes a single cell has been specified for the
argument... you may want to provide error trapping for this, but I didn't
know if you just wanted to quietly exit the sub or if you wanted to raise an
error of some sort, so I left it out of the code so you could handle it
however you wanted to.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Thanks for your efforts. I was a little surprised to discover that I
could
apply a Method (ShowPrecedents) to a cell, and not have a Property to
verify
it had been done.

I later realized that I was just dropping Shapes on the worksheet and
maybe
the Shapes could supply the info......
--
Gary''s Student - gsnu200909


"Rick Rothstein" wrote:

I've been looking at your problem from when you first posted it... yes,
the
Formula Auditing does seem to matter. A normal line has a TopLeftCell and
a
BottomRightCell property which you can reference to get their Address
properties; however, lines drawn by the Formula Auditing appear to be
different in that they do not have these properties. I'm still looking
(on
and off) at some ideas on how do solve your problem though.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in
message
...
Somewhere on my worksheet is a single Shape. It is a line with an
arrowhead
at one end. The line begins in one cell and ends (arrow head side) in
another cell. How can a macro determine the address of these two
cells?

If it matters, the line was drawn by Formula Auditing.

Thanks
--
Gary''s Student - gsnu200909


.