Error Message = Microsoft Excel cannot paste the data (Run-time error '1004')

WallisAggie646777

New Member
Joined
May 6, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
The following 6 lines of code are contained in a worksheet Command button in the "Weekly" worksheet
When I click on the command button, the cannot paste error occurs.

With Sheets("Groups")
.Range(wsGroups.Cells(MonR, GroupC), wsGroups.Cells(GroupFriR + 4, GroupEndC)).Copy '
End With
wsWeekly.Activate ' "Weekly" worksheet
Range("A40").Select
ActiveSheet.Pictures.Paste(Link:=True).Select :The cannot paste error occurs on this line of code.

I can set a breakpoint on the line of code causing the error and then click on the Command button.
Execution stops on the line where the error occurred. I then use F8 to Step into to execute the line of code and it works by pasting the data as expected

In summary, with no breakpoint, the code fails when clicking on the Command button, but with the breakpoint, I can click on the Command button and then use F8 to step into the line of code and the code pastes the data as expected.
 
No problem, we have a few more tricks to try. So you click the button on Test worksheet and it erred? If so, you have something else really odd going on.

Looking at possible reasons, I "trust" that you have trusted macros and VBA access?
  1. Open a blank workbook in Excel.
  2. Go to File > Options > Trust Center
  3. Click on Trust Center Settings...
  4. Under Macro Settings, make sure Trust access to the VBA project object model is checked.
Some other reasons might be conflicting AddIn. You should disable all and then try my workbook's button.

Could be a corrupted template file but let's leave that for last.
 
Upvote 0

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.

Forum statistics

Threads
1,215,214
Messages
6,123,665
Members
449,114
Latest member
aides

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