VBA to take result of SUM formula and paste into worksheet

Stu Dapples

Active Member
Joined
Jan 12, 2009
Messages
252
Think I am losing the plot...

Simple - select a cell, copy - selct another cell in a different worksheet, paste.... Easy....

Origin cell has formaula in it (=SUM(A1:A5)

It copies OK but when I paste, I just get #Ref error - it is pasting the formula and not the value (so the cell now contains (=Sum(#Ref))

Tried PasteSpecial, Paste, xlPasteValues - nothing.... Am I missing something?!

Code:

Sheet3.Range("L28").Copy Sheet9.Range("K12").PasteSpecial = xlPasteValues
 
Which line of code is highlighted when you click debug?
Sheet9.Range("K12").PasteSpecial = xlPasteValues
VB.PNG
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
(y)(y)(y)
I can't believe that took me so long!! That's what 5 years without coding will do - maybe time to go back to school....

Thanks Gents, much appreciated as ever
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,217,378
Messages
6,136,204
Members
450,000
Latest member
jgp19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top