run-time error '1004': Paste method ow Worksheet class failed

r_simpson42

New Member
Joined
Sep 25, 2013
Messages
8
One user (of many) receives the run-time error '1004': Paste method of Worksheet class failed
on the line "ActiveSheet.Paste" (see below for example macro)
I have many users here at work that use a whole slew of these types of macros as tickmarks in their Excel workpapers. They work for everyone, except one.
The macro is supposed to paste a small image (.png) into the excel worksheet.
Any ideas what could case this?
The macro is written in the below fashion in order to display the image on computers that do not have the macros and .png files installed on them.
Sub Senior_Ties_to_Prior_Year()
'
' Senior_Ties_to_Prior_Year Macro
'
'
ActiveSheet.Pictures.Insert("C:\Tick marks\Green Prior Year.png").Select
Selection.CopyPicture
Selection.Delete
ActiveSheet.Paste
ActiveCell.Select
End Sub

Thank you for your thoughts and suggestions!
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,711
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Do they have a protected worksheet ??
Have you tried pasting before deletion ?

Code:
Sub Senior_Ties_to_Prior_Year()
ActiveSheet.Pictures.Insert("C:\Tick marks\Green Prior Year.png").Select
Selection.CopyPicture
ActiveSheet.Paste
Selection.Delete
End Sub
 

r_simpson42

New Member
Joined
Sep 25, 2013
Messages
8
No, the worksheet is not protected, and sometimes the macro does work and sometimes he get the error.
It looks to me like I am pasting before deletion...so not sure what you mean.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,711
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
your code does this !

Code:
Selection.CopyPicture
[color=red]Selection.Delete
ActiveSheet.Paste[/color]
ActiveCell.Select
I suggested reversing the 2 lines in red !
 

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,631
Members
414,082
Latest member
sasmita

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
Top