Copy 2 worksheets to new workbook without code

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
Can anyone show me how I can copy 2 specific worksheets to a new workbook but without the macros attached to them?

I can copy a sheet to a new workbook fine, I can rename the sheet fine, but I'm struggling to do it with 2 sheets. This is what I have so far which works fine for 1 sheet:

Code:
ReportDate = Format(Now, "dd_mm_yy_hh_mm")

Fname = ThisWorkbook.path & "\Reports\121 Manager Report_" & ReportDate & ".xlsx"
Sheets("MANAGERS").Copy
For Each ws In ActiveWorkbook.Worksheets
    With ws.UsedRange
  .Value = .Value
    End With
Next ws
With ActiveWorkbook
Sheets("MANAGERS").Name = "121_MANAGERS_" & ReportDate
    .SaveAs FileName:=Fname
    .Close
End With

What I need in full is;

1) Copy the sheets to a new workbook (without code)
2) Rename each of the sheets in the new workbook (to a name yet to be decided)
3) Save the new workbook with a new name as an xlsx file and then close
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about
Code:
Sheets(Array("MANAGERS", "Sheet1")).Copy
 
Upvote 0
Fluff, thanks - that works in the respect that it copies both sheets but each sheet still has the code attached, is there an easy way I can remove it?
 
Upvote 0
You don't need to as you are saving as an xlsx file
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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