ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable in formula problem (https://www.excelbanter.com/excel-programming/436150-variable-formula-problem.html)

HarryGuy

Variable in formula problem
 
I have a formula,

ActiveCell.FormulaR1C1 = "=(Origin!RC[cC]-Origin!R3C[cC])/Origin!R3C[cC]"

which I want to insert into "A3", "B3" etc. for about 30 additional columns.
I then plan to extend the results to the last cell down each column, using
"Auto-Fill". "cC" is a variable in the formula.

For example:

rts.Cells(ratdtR + 1, ratdtC + g).Select

Selection = "=(Origin!RC[3]-Origin!R3C[3])/Origin!R3C[3]"

Selection.AutoFill Destination:=Range(Cells(invdtR + 1, invdtC + g),
Cells(lstcelR, invdtC + g)),Type:=xlFillDefault

works (assuming cC = 3) but I do not know how to code "cC" programatically.

Can someone help me with this problem.





Dave Peterson

Variable in formula problem
 
Check your earlier post.

HarryGuy wrote:

I have a formula,

ActiveCell.FormulaR1C1 = "=(Origin!RC[cC]-Origin!R3C[cC])/Origin!R3C[cC]"

which I want to insert into "A3", "B3" etc. for about 30 additional columns.
I then plan to extend the results to the last cell down each column, using
"Auto-Fill". "cC" is a variable in the formula.

For example:

rts.Cells(ratdtR + 1, ratdtC + g).Select

Selection = "=(Origin!RC[3]-Origin!R3C[3])/Origin!R3C[3]"

Selection.AutoFill Destination:=Range(Cells(invdtR + 1, invdtC + g),
Cells(lstcelR, invdtC + g)),Type:=xlFillDefault

works (assuming cC = 3) but I do not know how to code "cC" programatically.

Can someone help me with this problem.


--

Dave Peterson


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

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