Paste Is Failing

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to use this code:

Code:
With Worksheets("MasterWKSH")
            .Cells.Copy
                With Worksheets("CUE")
                    .Cells.Paste
                End With
        End With

To copy the contents of Worksheets("MasterWKSH") to Worksheet("CUE"). The copy is made, but the paste fails.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Code:
Worksheets("MasterWKSH").Cells.Copy Destination:=Worksheets("CUE").Range("A1")
</pre>
 
Upvote 0
Wow... that was so much more efficient! Worked like a charm!
I noticed that the format was carried over ... row heights were the same, but not the column widths. Is there a way that the column widths can be carried over as well Rory?
 
Upvote 0
Why don't you just copy the sheet if you want an identical copy?

You could try
Code:
Worksheets("MasterWKSH").Cells.Copy
with Worksheets("CUE").Range("A1")
.Pastespecial xlpasteall
.pastespecial xlpastecolumnwidths
end with

</pre>
 
Upvote 0
Thanks Rory for he reply and suggestion.

Why don't you just copy the sheet if you want an identical copy?

The new worksheet isn't really identical. The source worksheet has been filtered, and only the filtered data needs to be carried over to the destination worksheet.

I included your code ... and two issues:
1) it isn't copying over the graphical elements (logo)
2) it pastes the data and cell formatting, however, when the .pastespecial xlpastecolumnwidths is executed, it clears the worksheet of the data. The formatting and column widths are still there, but no data.
 
Upvote 0

Forum statistics

Threads
1,214,524
Messages
6,120,049
Members
448,940
Latest member
mdusw

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