Macro Sum of Cells

H

herve

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
 
M

Mike Mertes

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'...)
 
H

herve

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

Bob Phillips

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)
 
D

Dave Peterson

One more based on Bob's response:

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

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

Top