Hopefully this is a simple one...
That line of code produces a formula in the target cell along the lines of "=SUM($A$7:$A$10)"
The problem is that later in my code I run a horizontal sort and afterwards all of the formulas are wrong because the absolute column references don't change with the sort (i.e. column A is now Column C, yet the formulas in Column C are all still "=SUM($A$7:$A$10)"
Is there a way around this using my existing code, or do I need to utilize R1C1 or something like that? If so can someone assist with the line above?
Thanks!
Mike
Code:
Cells(LastRow + 1, c).Formula = "=SUM(" & Cells(7, c).Address & ":" & Cells(LastRow, c).Address & ")"
That line of code produces a formula in the target cell along the lines of "=SUM($A$7:$A$10)"
The problem is that later in my code I run a horizontal sort and afterwards all of the formulas are wrong because the absolute column references don't change with the sort (i.e. column A is now Column C, yet the formulas in Column C are all still "=SUM($A$7:$A$10)"
Is there a way around this using my existing code, or do I need to utilize R1C1 or something like that? If so can someone assist with the line above?
Thanks!
Mike