How To Copy Sum of Cell Values vs A Single Cell Value

M

Mike Taylor

The code below copies the value of cell d8 from one worksheet and
pastes the value and format of that cell into column M of a different
worksheet ("DestSh"). What is the code that would copy the sum of
cells d8:d10 rather than only the value in cell d8?

sh.Range("d8").Copy
With DestSh.Cells(Last + 1, "m")
.PasteSpecial xlPasteValues, , False, False
.PasteSpecial xlPasteFormats, , False, False
Application.CutCopyMode = False
End With

Thanks in advance for any feedback...
Mike Taylor
 
C

chris

sh.Range("d8").Cop
Set MyRange = Range("d8:d10"
With DestSh.Cells(Last + 1, "m")
.PasteSpecial xlPasteFormats
.Value = Application.WorksheetFunction.Sum(MyRange)
End Wit
----- Mike Taylor wrote: ----

The code below copies the value of cell d8 from one worksheet an
pastes the value and format of that cell into column M of a differen
worksheet ("DestSh"). What is the code that would copy the sum o
cells d8:d10 rather than only the value in cell d8

sh.Range("d8").Cop
With DestSh.Cells(Last + 1, "m"
.PasteSpecial xlPasteValues, , False, Fals
.PasteSpecial xlPasteFormats, , False, Fals
Application.CutCopyMode = Fals
End Wit

Thanks in advance for any feedback..
Mike Taylo
 
M

Mike Taylor

Would someone be kind enough to offer a suggestion to my earlier
post...I've searched the postings and not been able to figure this one
out...TIA
Mike
 
E

Earl Kiosterud

Mike,

Sheets("DestSh").Range("D4") =
Application.WorksheetFunction.Sum(Sheets("Sh").Range("D8:D10"))

Or
Sheets("DestSh").Range("D4") = Sheets("DestSh").range("D8") + _
Sheets("DestSh").range("D9") + _
Sheets("DestSh").range("D10")

I've put it in D4. You can apply your own magic.
 
Top