View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default change a formula

The built in function
sForm = "=A2+B2"
? application.ConvertFormula(sForm,xlA1,xlA1,xlAbsol ute)
=$A$2+$B$2

will not work on just one argument, so you would have to develop custom code
to do the conversion.

You can get the directprecedents

? Range("A10").DirectPrecedents.Address
$A$2:$B$2


but this doesn't seem real useful in this case.

? replace(sForm,"A2","$A$2")
=$A$2+B2

is a very specific solution. You would have to state your real need and
what the conditions are.

--
Regards,
Tom Ogilvy

"jobra" wrote in message
...
Hi, is there a programming way to change this:
Cell A10=A2+B2
into this
Cell A10=$a$2+B2
Thanks in advance