Variable excel formula
Hi Dave:
Don't you just flex the
ActiveCell.FormulaR1C1 = "=RC[-2] - R13C12"
as in
ActiveCell.FormulaR1C1 = "=RC[-2] - R13C" & 12 + someadjustment
where someadjustment is the offset to the cell R13C12?
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.
"Dave" wrote:
For I = 1 To count
ActiveCell.FormulaR1C1 = "=RC[-2] - R13C12"
ActiveCell.Offset(1, 0).Select
Next I
This loop is used to fill in the delay for all the female parent rows.
"Count" is the number of female rows. The formula calculates the value of the
cell two to the left of the active cell (the female parent GDU, this value
changes in each record) minus the value in cell R13C12 (male parent GDU, all
males are the same so this GDU value stays the same. I don't have the same
number of males and females so this part of the formula has to be an absolute
reference).
I run this calcuation for blocks of records. When I finish one block I loop
through the male parents in that block, find the count of female parents in
the next block and want to go back to the above section, but with the correct
reference for the male parent GDU, which will no longer be R13C12.
|