Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following 3 statements are repeated few times in succession in a VBA
macro. The code works fine. ' for row index 12, and post result into cell Q12 Set myFormula = myFormula.Offset(, 1) myFormula.Formula = "= C21*$D$12^D21*$E$12^E21*$F$12^F21* ... " Range("Q12").Offset(0, 0).Formula = "=sum(" & myFormula.Rows().Address(False, True) & ")" ' for row index 11, and post result into cell R11 Set myFormula = myFormula.Offset(, 1) myFormula.Formula = "= C21*$D$11^D21*$E$11^E21*$F$11^F21* ... " Range("Q12").Offset(-1, 1).Formula = "=sum(" & myFormula.Rows().Address(False, True) & ")" ' for row index 10, and post result into cell S10 Set myFormula = myFormula.Offset(, 1) myFormula.Formula = "= C21*$D$10^D21*$E$10^E21*$F$10^F21* ... " Range("Q12").Offset(-2, 2).Formula = "=sum(" & myFormula.Rows().Address(False, True) & ")" and so on. How can I modify the statement myFormula.Formuls so that I may include the 3 statements in a loop, changing only the row index from 12 to 11 to 10 to 9 etc. ? Thank you kindly. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Complex AND OR Formula | Excel Worksheet Functions | |||
Complex formula help | Excel Discussion (Misc queries) | |||
complex color fill conditions- if statements or complex formula? | Excel Discussion (Misc queries) | |||
need complex if formula (I think) | Excel Worksheet Functions | |||
Do---Loop Error in Complex Code | Excel Programming |