Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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
_ _
^ąŻ^
--






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
_ _
^ąŻ^
--




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Large formula BuckinB Excel Worksheet Functions 7 November 3rd 09 06:29 PM
Formula too large Cindyt Excel Discussion (Misc queries) 4 July 14th 09 07:31 PM
How many chart types does excel have: please exact ammount? GuyGardner89 Charts and Charting in Excel 3 November 13th 08 01:59 AM
How many chart types does excel have: please exact ammount? GuyGardner89 Excel Discussion (Misc queries) 1 November 12th 08 01:54 AM
Program colunm to switch receievable ammount from 30 to 60 days Steph Excel Discussion (Misc queries) 1 November 26th 07 07:37 PM


All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"