ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add large ammount of formula (https://www.excelbanter.com/excel-programming/307650-add-large-ammount-formula.html)

Nick

Add large ammount of formula
 
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

Frank Kabel

Add large ammount of formula
 
Hi
in C1 enter
=A1+B1
and just copy down

--
Regards
Frank Kabel
Frankfurt, Germany


Nick wrote:
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



Nick

Add large ammount of formula
 
yes, i know, but i would like to do it using vba


Frank Kabel wrote:

Hi
in C1 enter
=A1+B1
and just copy down

--
Regards
Frank Kabel
Frankfurt, Germany


Nick wrote:

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




Tom Ogilvy

Add large ammount of formula
 
Range("C1:C1000").Formula = "=A1+B1"

Excel will adjust the row numbers for you.

--
Regards,
Tom Ogilvy


"Nick" wrote in message
...
yes, i know, but i would like to do it using vba


Frank Kabel wrote:

Hi
in C1 enter
=A1+B1
and just copy down

--
Regards
Frank Kabel
Frankfurt, Germany


Nick wrote:

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






Soo Cheon Jheong[_2_]

Add large ammount of formula
 
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
_ _
^вп^
--





Nick

Add large ammount of formula
 
Thanks all .

Thanks

Nick

Soo Cheon Jheong wrote:

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
_ _
^вп^
--






All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com