Copy a sheet from a closed workbook and it should have a new name in the target workbook

bklabel1

Board Regular
Joined
Feb 24, 2015
Messages
134
VBA Code:
Set closedBook = Workbooks.Open("c:\sourcebook.xlsx")
closedBook.sheets("CopyMe").Copy before :=ThisWorkbook.Sheets("Sheet1")
CopyMe.name = "newName"

I know that I can copy and then rename the sheet in the Target workbook.
My challenge is I already have a workbook with that name. I don't want it to say CopyMe (2) and then have to do a rename.

Is there a way to do a copy and have the name of the sheet be some thing else when it gets added to the target book?

Thanks,

Kevin
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,373
Messages
6,124,546
Members
449,169
Latest member
mm424

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