ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Summing a range (https://www.excelbanter.com/excel-programming/367920-summing-range.html)

Alan M

Summing a range
 
Hi,

I need to use VBA code to define a range and then sum the values of the
cells in that range and place the answer in another cell. So far I have this
but it does not work!

I have defined ReportRange as the range to be summed and RangeValue as Long
to be used for the result

Set ReportRange = Sheets(2).Range(Cells(7, 24), Cells(EndDate, 24))

RangeValue = "=Sum(" & ReportRange.Address(True, False) & ")"


Sheets(16).Select


Sheets(16).Range("d12").Value = RangeValue


Where am I going wrong please?


Alan


All times are GMT +1. The time now is 04:56 PM.

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