View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default How do I use VBA to add a formula?

Hi
try
Range(row1, column3).formulaR1C1="=R[0]C[-2]*R[0]C[-1]"

--
Regards
Frank Kabel
Frankfurt, Germany


hello Xpertz!

I'm sure this question has been asked, but anyway...

I need to do some math on a cost sheet. Simple stuff:

Range(row1, column3) = Range(row1,column1)*Range(row1,column2)

What I would like to do is make column3 autoupdate whenever I change
column1 or column2. I tried using formulas like this:

Range(row1, column3).Formula = "=" &

Range(row1,column1).Address(True,
True, , True)*Range(row1,column2).Address(True, True, , True)

But that only makes column3 show a zero. Worse yet, sometimes

column1
or 2 is empty or a string. I noticed that if I manually enter a
formula on the complete table it works fine, only when I try it in

vba
do I have a problem.


---
Message posted from http://www.ExcelForum.com/