View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Extracting 'exact' local references from formula

Antony,

A bit nasty, but is this of any use

Set rng = ActiveCell.DirectPrecedents
For Each area In rng.Areas
Debug.Print area.Parent.Name & "!" & area.Address
Next area


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ant Bewes" wrote in message
om...
Is there any way to get the exact string representing the local
references as the user entered it in the formula?

For example:

Cell A1 in Sheet1: "=Sheet2!G66+Sheet1!B$7-$A9"

Getting DirectPrecedents yields:
"$B$7" and "$A$9" for Address

What I *really* want is:
"Sheet1!B$7" and "$A9"

The frustrating thing is when I double click in the cell (edit mode)
Excel will colour these exact strings - But I can't find anyway of
getting to them in a macro :-(

Any help appreciated!

Antony