summing cells

  • Thread starter Thread starter CG Rosén
  • Start date Start date
C

CG Rosén

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
 
Result = Range("A1").Value + Range("N1").Value

or if putting into cell on worksheet eg C2

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


Cheers
Nigel
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top