Home>

I have a question about a VBA macro code error.
We use "Cut" and "Paste Special".


Sub test
Worksheets (1) .Range ("A1"). Cut'... (A)
Worksheets (2) .Range ("A1"). PasteSpecial'... (B)
End Sub


Error '1004' ... Failed. Will be.

It works when (A) is Copy instead of Cut.
It worked when (B) was set to Worksheets (2) .Paste.

Immediately before executing PasteSpecial, the clipboard is CutMode and the data is Text.

I saw the article "If i omit Destination, Paste Special cannot be used", but if you use Destination, you have to paste it anywhere, and the clipboard becomes empty after execution and paste You won't be able to do that.

How should I handle it?
Why does PasteSpecial throw an error when using Cut?

  • Answer # 1

    Why does PasteSpecial throw an error when using Cut?

    Because it is such a specification.
    Manually "cut" and then right-click on the cell you want to paste.
    "Select format and paste" is grayed out and cannot be selected.
    Since the operation "cut" cuts everything, it is a specification that you can not select and paste only a part.

    Even if it is troublesome, copy it, "Paste Special", and then delete the copy source cell.