VBA: create new workbook, rename, copy sheets from original to new with exceptions

kweaver

Well-known Member
Joined
May 12, 2009
Messages
2,934
Office Version
  1. 365
  2. 2010
From a VBA routine, I want to create a new workbook, rename it (so that I can date stamp the name), then copy sheets from original workbook except certain sheets (only 3 not copied).
Then delete the copied sheets from the original workbook.

I've been messing with this for over an hour and can't get it right. Thanks in advance.
 
You're welcome & thanks for the feedback.
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Added question, Fluff. Once that new workbook has been created, sheets moved/deleted, and saved...I'd like to very-hidden two of the remaining sheets.
However, the new workbook is the active one, so where would I place a revert back to the original and hide those two sheets?

I think I resolve that.
 
Upvote 0
Is the code located in the original workbook?
 
Upvote 0
In that case just add this to the end of the code & change sheet names to suit
VBA Code:
   With ThisWorkbook
      .Sheets("Sheet1").Visible = xlSheetVeryHidden
      .Sheets("Sheet2").Visible = xlSheetVeryHidden
   End With
 
Upvote 0
Solution

Forum statistics

Threads
1,216,446
Messages
6,130,699
Members
449,586
Latest member
spg5150

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