ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell refs in formula (https://www.excelbanter.com/excel-programming/388329-cell-refs-formula.html)

Boba

cell refs in formula
 
Dear All;
How do I reference cells in formulas?
I need an example of VB macro that fills up
the cell range C1000:C2000 with formulas
so they show pairwise sums of A2000:A3000
and B3000:B4000 cells
//from C++
for(int i=0; i<1000; i++)
cellC[i+1000]=cellA[i+2000]+cellB[i+3000]
Thanks in advance.



Dave Mac

cell refs in formula
 
On 28 Apr, 04:57, "Boba" wrote:
Dear All;
How do I reference cells in formulas?
I need an example of VB macro that fills up
the cell range C1000:C2000 with formulas
so they show pairwise sums of A2000:A3000
and B3000:B4000 cells
//from C++
for(int i=0; i<1000; i++)
cellC[i+1000]=cellA[i+2000]+cellB[i+3000]
Thanks in advance.


try....

Range("C1000").FormulaR1C1 = "=SUM(RC[-2]:RC[-1])"
Range("C1000").AutoFill Destination:=Range("C1000:C3000"),
Type:=xlFillDefault


Boba

cell refs in formula
 
Perfect. Thanks for the lesson.




All times are GMT +1. The time now is 03:54 AM.

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