I would like to copy a sheet from ActiveWorkbook, to a New Created workbook. The New created workbook, will contains the copied sheet ONLY.
I also don't want it to open while copiying the sheet. I want to copy the sheet to the new created workbook silently.
If I do something like the following, the new created book is with 3 sheets, not one only, and it's opening while copiying. and also it's asking me if i want to saved it with Macro, while I only want to copy the sheet1, so no need for any macro with it, How to fix that to fits my needs ?
ThisWorkbook.Sheets("Sheet1").Copy
ActiveWorkbook.SaveAs "C:\DestinationWb.xlsx", FileFormat:=51
The only way I can think of in such a scenario is to do the following.
Logic:
.SaveCopyAs
method to save a copy of the existing workbook. You can read more about.SaveCopyAs
HERECode:
The newly created workbook will have to be open - otherwise how would you save it? - but toggling
Application.ScreenUpdating
might facilitate the "silent" copy you're looking for. TogglingApplication.DisplayAlerts
will also suppress alerts as needed.