VBA paste special won't work after cut

Gylle

New Member
Joined
Apr 10, 2022
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hi all

I'm using this code:

Sub PasteAsValue()
Selection.PasteSpecial Paste:=xlPasteFormulas
End Sub

to keep the formatting in worksheet.
It works as intented.

However if I for some reason need to cut (ctrl-x) in the worksheet and try to paste with ctrl-v it returns error 1004

I can use the mouse right click to paste or via excel menu, no problem, but not via shortcut?
 

Attachments

  • Skærmbillede 2022-04-20 202246.png
    Skærmbillede 2022-04-20 202246.png
    6.9 KB · Views: 9

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
My guess is that you assigned the short cut key ctrl+v to your macro.
I don't think that is a good idea it is far too useful and commonly used shortcut key to be reassigned and if you use that on anyone else's computer they will be really annoyed.

The VBA Paste only allows the same functions as if you were doing it manually.
If you do it manually Copy allows Paste Special but Cut does not.

That is why trying to paste formulas is erroring out


1650524126783.png
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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