Sum in a dynamic range
Hi
I need to produce code to add a formula in a cell at the bottom of a column full of data which sums the values in that column. However the number of rows in the column may vary. I can see the a formula R1C1 is needed to take the Sum function but this requires R1C1 references. How can I change this to accept the dynamic range. |
Sum in a dynamic range
Alan -
Sub d() With Sheet1.Range("c1") .End(xlDown).Offset(1).Formula = "=sum(" & .Address & ":" & ..End(xlDown).Address & ")" End With End Sub "Alan M" wrote in message ... Hi I need to produce code to add a formula in a cell at the bottom of a column full of data which sums the values in that column. However the number of rows in the column may vary. I can see the a formula R1C1 is needed to take the Sum function but this requires R1C1 references. How can I change this to accept the dynamic range. |
All times are GMT +1. The time now is 08:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com