ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   summing cells (https://www.excelbanter.com/excel-programming/318120-summing-cells.html)

CG Rosén

summing cells
 
Hi Group,

Sorry for a probably simpel question.
What code to use for adding the values of
cells A1 to N1 in VBA, without using the FormulaR1C1 method?

Brgds

CG Rosén



Nigel

summing cells
 

Result = Range("A1").Value + Range("N1").Value

or if putting into cell on worksheet eg C2

Range("C2").Formula = "=A1 + N1"


Cheers
Nigel


"CG Rosén" wrote in message
...
Hi Group,

Sorry for a probably simpel question.
What code to use for adding the values of
cells A1 to N1 in VBA, without using the FormulaR1C1 method?

Brgds

CG Rosén





Don Guillett[_4_]

summing cells
 
MsgBox Application.Sum(Range("a1:n1"))

--
Don Guillett
SalesAid Software

"CG Rosén" wrote in message
...
Hi Group,

Sorry for a probably simpel question.
What code to use for adding the values of
cells A1 to N1 in VBA, without using the FormulaR1C1 method?

Brgds

CG Rosén





sebastienm

summing cells
 
Hi,
To sum a1:n1 of the active sheet:
Dim v as Variant
v = application.WorksheetFunction.Sum(range("A1:N1"))
Then you can place it in another cell: Range("A2") = v

Regards,
Sebastienm

"CG Rosén" wrote:

Hi Group,

Sorry for a probably simpel question.
What code to use for adding the values of
cells A1 to N1 in VBA, without using the FormulaR1C1 method?

Brgds

CG Rosén





All times are GMT +1. The time now is 03:54 PM.

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