Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing 2 columns cells into a 3rd colums cells Wayne Cadigan Excel Discussion (Misc queries) 1 May 13th 10 08:34 PM
not summing all the cells Alina Roumania Excel Discussion (Misc queries) 2 April 13th 10 09:41 AM
Summing Cells with #N/A Joan NYC Excel Worksheet Functions 8 February 26th 07 07:57 AM
Summing of Two cells does not sum!! Joe D Excel Discussion (Misc queries) 2 July 17th 05 10:53 PM
Finding cells and summing variable cells Chris M.[_3_] Excel Programming 3 August 21st 03 09:13 PM


All times are GMT +1. The time now is 10:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"