ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to copy workbook with several worheets (https://www.excelbanter.com/excel-discussion-misc-queries/205489-macro-copy-workbook-several-worheets.html)

CC

macro to copy workbook with several worheets
 
I've try make a macro to copy all worksheets from one Workbook and create
another workbook with same ammount of sheets
somebody can help ?



joel

macro to copy workbook with several worheets
 
If you copy sheets and don't use copy a new workbook is create with only one
page. Try this code

First = True
For Each sht In ThisWorkbook.Sheets
If First = True Then
sht.Copy
Set newbk = ActiveWorkbook
First = False
Else
sht.Copy after:=newbk.Sheets(newbk.Sheets.Count)
End If
Next sht

"CC" wrote:

I've try make a macro to copy all worksheets from one Workbook and create
another workbook with same ammount of sheets
somebody can help ?



Dave Peterson

macro to copy workbook with several worheets
 
Why not just save the file as a new name?

Or use windows explorer to copy the file?

CC wrote:

I've try make a macro to copy all worksheets from one Workbook and create
another workbook with same ammount of sheets
somebody can help ?


--

Dave Peterson


All times are GMT +1. The time now is 05:39 AM.

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