Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Sum of Cells


Hello all,
could someone help me to write a Macro :

I Have Numbers in Cells B12 to B?? (Variable) & Cells C12 to
C??(Variable)
In Cells D12 to D?? (to the last one), I want to do the sum of the
respective B+C Cells.

For Example,
D12 = B12 + C12
.....
.....
D20 = B20 + C20
.....

Thanks in Advance


--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=481834

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Macro Sum of Cells

Sounds like you'd be best off with in cell operations. Did you try adding
them right in the D column? Like D12: '=B12+C12', then copying that formula
down the rows. Or did you want that it should be automated/callable and
result in raw values? (Hence the 'Macro'...)


"herve" wrote in
message ...

Hello all,
could someone help me to write a Macro :

I Have Numbers in Cells B12 to B?? (Variable) & Cells C12 to
C??(Variable)
In Cells D12 to D?? (to the last one), I want to do the sum of the
respective B+C Cells.

For Example,
D12 = B12 + C12
....
....
D20 = B20 + C20
....

Thanks in Advance


--
herve
------------------------------------------------------------------------
herve's Profile:
http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=481834



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro Sum of Cells


For i = 12 To Cells(Rows.Count).End(xlUp).Row
Cells(i,"D").Formula = "=B" & i & "+C" & i
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Mertes" wrote in message
...
Sounds like you'd be best off with in cell operations. Did you try adding
them right in the D column? Like D12: '=B12+C12', then copying that

formula
down the rows. Or did you want that it should be automated/callable and
result in raw values? (Hence the 'Macro'...)


"herve" wrote in
message ...

Hello all,
could someone help me to write a Macro :

I Have Numbers in Cells B12 to B?? (Variable) & Cells C12 to
C??(Variable)
In Cells D12 to D?? (to the last one), I want to do the sum of the
respective B+C Cells.

For Example,
D12 = B12 + C12
....
....
D20 = B20 + C20
....

Thanks in Advance


--
herve
------------------------------------------------------------------------
herve's Profile:
http://www.excelforum.com/member.php...o&userid=27314
View this thread:

http://www.excelforum.com/showthread...hreadid=481834





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Sum of Cells


Hi bob,
that macro seems not working.
Regards
Herve


--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=481834

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Sum of Cells


Thanks Mike, but would prefer to do it by macro,
First, select the last B and C cell and after, do the sum.
Regards


--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=481834



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro Sum of Cells

One more based on Bob's response:

range("d12:d" & cells(rows.count,"B").end(xlup).row).Formula = "=B12+c12"

herve wrote:

Thanks Mike, but would prefer to do it by macro,
First, select the last B and C cell and after, do the sum.
Regards

--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=481834


--

Dave Peterson
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
macro copy/paste data from multiple cells to multiple cells Diana Excel Discussion (Misc queries) 0 July 10th 06 09:24 PM
macro to colour empty cells (cells not recognized as empty) Gerben Excel Programming 5 June 30th 05 03:29 PM
Macro - Playing Macro if cells are locked sonar[_5_] Excel Programming 1 May 1st 04 03:13 AM
a script/macro to copy a block of cells next to specified cells z.entropic[_2_] Excel Programming 8 November 14th 03 03:17 PM
Merge cells using macro Tom Ogilvy Excel Programming 0 August 7th 03 07:20 PM


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

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

About Us

"It's about Microsoft Excel"