Add large ammount of formula

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

Hi,

my current excel has:

A B C
1 1
2 2
3 3
4 4
n n

I would like to let the value in column C is =Ax + Bx, where x is the
row number, but how to add this formula in a batch?

currently, i only can loop all the row and add manually :

e.g.

for i = 1 to 1000
range("C" & i ).formula = "=A" & i & "+B" & i
next

any other or faster method?

nick
 
Range("C1:C1000").Formula = "=A1+B1"

Excel will adjust the row numbers for you.
 
Nick,

Try
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub TEST_1()
Range("C1:C1000").Formula = "=A1+B1"
End Sub

Sub TEST_2()
Range("C1:C1000").Value = "=A1+B1"
End Sub

Sub TEST_3()
Range("C1:C1000").Formula = "=RC[-2]+RC[-1]"
End Sub

Sub TEST_4()
Range("C1:C1000").Value = "=RC[-2]+RC[-1]"
End Sub

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -


--
Regards,
Soo Cheon Jheong
_ _
^¢¯^
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top