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
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try it like
VBA Code:
Sheet9.Range("K12").Value=Sheet3.Range("L28").Value
 
Upvote 0
The paste special needs to be on the nest line, not as an argument to the copy
VBA Code:
Sheet3.Range("L28").Copy
Sheet9.Range("K12").PasteSpecial = xlPasteValues
 
Upvote 0
Gallen - I need it to paste to this range in one scenario and elsewhere in others which I am coding through - I want to get the value on teh clipboard and then define where it is by confirming other states are true using IF commands - I will try the nest line!

Fluff - Thanks for the suggestion :)
 
Upvote 0
Run Time Error '424':
Object required

???
Only thing that could cause that is if sheet3 or sheet9 doesn't exist. Check the spelling and sheet names. Remember that "Sheet9" refers to the object named Sheet9 and not a sheet named Sheet9.

Also confirm that the sheet isn't protected
 
Upvote 0
VB.PNG
 
Upvote 0
Which line of code is highlighted when you click debug?
 
Upvote 0

Forum statistics

Threads
1,216,385
Messages
6,130,314
Members
449,572
Latest member
mayankshekhar

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