.Copy Method for 2 Different Items (Run Time Error)

Pepperdine21

New Member
Joined
Jul 9, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am having some trouble with some VBA code that involves copying a shape and copying a range. I am using the .Copy method for both of them and I think this is where the error is arising from.

My code looks similar to this:

VBA Code:
 Sheets("Sheet1").Range("A2:D65").Copy

'additional code in between

Sheets("Sheet3").Range("B1").PasteSpecial xlPasteAll

'additional code in between

Dim GrpShp As Shape
Set GrpShp = Worksheets("Hidden").Shapes.Range(Array("Picture 8", "Picture 7", "Picture 9")).Group
GrpShp.Copy

'additional code after

When I attempt to run this code I get a runtime error. "Method 'Copy' of object 'Shape' failed. However, when I separate the code into 2 different subs the code works correctly. I think it's giving me the error for the shape object because it is the 2nd item I used the .Copy method. Is there a way to use the .Copy method (or achieve the same functionality) on 2 different items within the same sub without getting a runtime error?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
No errors over here, there might be something within your "additional code in between" that is causing you this issue.
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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