ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Duplicate all Macros? (https://www.excelbanter.com/excel-programming/363596-duplicate-all-macros.html)

stevec

Duplicate all Macros?
 
This is part of a macro that duplicates sheets into a new workbook and lets
me save them someplace else... only problem, it leaves behind all macros....
how do I take all macros from the original workbook and duplicate them into
the new workbook? thanks a lot!

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Select
Sheets("Sheet5").Activate
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Copy
Range("A34").Select
Selection.Copy
Application.CutCopyMode = False
ChDir " U:\Folder1\Folder2\Folder3"
Application.Dialogs(xlDialogSaveAs).Show "U:\Folder1\Folder2\Folder3"


SteveM

Duplicate all Macros?
 
Steve,

What don't you Save As to a new workbook and then delete the sheets you
don't want in that workbook?

SteveM

SteveC wrote:
This is part of a macro that duplicates sheets into a new workbook and lets
me save them someplace else... only problem, it leaves behind all macros....
how do I take all macros from the original workbook and duplicate them into
the new workbook? thanks a lot!

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Select
Sheets("Sheet5").Activate
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Copy
Range("A34").Select
Selection.Copy
Application.CutCopyMode = False
ChDir " U:\Folder1\Folder2\Folder3"
Application.Dialogs(xlDialogSaveAs).Show "U:\Folder1\Folder2\Folder3"



stevec

Duplicate all Macros?
 
I wanted to avoid that because all these sheets come from one large workbook,
and the macro pulls out only the sheets I need -- this is faster than doing
multiple Save As commands... but i will try to come up with a way to do
this... thanks for the suggestion...

"SteveM" wrote:

Steve,

What don't you Save As to a new workbook and then delete the sheets you
don't want in that workbook?

SteveM

SteveC wrote:
This is part of a macro that duplicates sheets into a new workbook and lets
me save them someplace else... only problem, it leaves behind all macros....
how do I take all macros from the original workbook and duplicate them into
the new workbook? thanks a lot!

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Select
Sheets("Sheet5").Activate
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5",
"Sheet6")).Copy
Range("A34").Select
Selection.Copy
Application.CutCopyMode = False
ChDir " U:\Folder1\Folder2\Folder3"
Application.Dialogs(xlDialogSaveAs).Show "U:\Folder1\Folder2\Folder3"





All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com