View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Relative address equations

have a look at:

application.ConvertFormula

then maybe following would work?

ActiveCell.FormulaR1C1= _
application.ConvertFormula( _
"=G12+(B13*D$5*E$8)/1000",xla1,xlr1c1,,[a12])

however since the "formula" is hardcoded there's no need to convert it
everytime you run the code.
get the result once in the immediate window by typing
?application.ConvertFormula("=G12+(B13*D$5*E$8)/1000",xla1,xlr1c1,,[a12]
)


and then code:

Activecell.Formular1c1="=RC[6]+(R[1]C[1]*R5C[3]*R8C[4])/1000"




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


OkieViking wrote :

I figured out how to do this using R1C1 nomenclature. But now I need
to enter an equation with absolute and relative references using VBA.
Here is the equation:

=G12+(B13*D$5*E$8)/1000

How would I enter an equation like this?

"OkieViking" wrote:

I want to write a code that inserts an equation, using relative
addresses (i.e. the cell above minus the cell to the left of the
active cell). How do i do that