Clipboard to a defined sheet

David2

New Member
Joined
Jan 13, 2018
Messages
39
I have a very basic question.


I've pasting clipboard content to a certain sheet (Sheet5) in cell A1 (document contains more sheets).


Code:
Sub Copy()
ActiveSheet.Paste Destination:=Worksheets("Sheet5").Range("A1")
End Sub

I'm been getting a lot of 1004 errors (paste method of worksheet class failed).


How can I paste clipboard content to a certain sheet and avoid this error? I want to open the document and paste the clipboard content without having to click on Sheet5.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hm, now I get a new error - "PasteSpecial method of Range class failed."

Is this perhaps related to clipboard data?
 
Upvote 0
If you really think you need to use Paste Destination

Use this:

Paste Destination:=Worksheets("Sheet5").Range("A1")

But you do need to have a sheet named "Sheet5"
 
Upvote 0
My Aswer Is This,


yes it is plain text. Could it be related to an empty clipboard error?


Are there some other options than using Paste Destination? I mean, I have to paste clipboard data in a certain sheet and cell but how I do it, is irrelevant - I just want to get rid of that error or understand why it happens.

And thanks :)
 
Upvote 0
Try this:
Code:
Sub Copy_Me()
'Modified  12/8/2018  10:49:09 AM  EST
On Error GoTo M
Worksheets("Sheet5").Range("A1").PasteSpecial
Application.CutCopyMode = False
Exit Sub
M:
MsgBox "Your ClipBoard is empty"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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