![]() |
creating new workbook from one sheet
Hi,
I would like to create a new xls file made of the content of ny current Sheet2 (not sheet1 or 3). is it possible? Many thanks, Dan |
creating new workbook from one sheet
Worksheets("Sheet2").Copy
-- __________________________________ HTH Bob "Dan" wrote in message ... Hi, I would like to create a new xls file made of the content of ny current Sheet2 (not sheet1 or 3). is it possible? Many thanks, Dan |
creating new workbook from one sheet
Hi Dan
Try this: Sub CopySheet2ToNewWb() Dim wbA As Workbook Dim wbNew As Workbook With Application SheetsInWb = .SheetsInNewWorkbook .SheetsInNewWorkbook = 1 .DisplayAlerts = False .ScreenUpdating = False End With Set wbA = ThisWorkbook Set wbNew = Workbooks.Add wbA.Sheets("Sheet2").Copy wbNew.Sheets(1) wbNew.Sheets("Sheet1").Delete With Application .SheetsInNewWorkbook = SheetsInWb .DisplayAlerts = True .ScreenUpdating = True End With End Sub Regards, Per "Dan" skrev i meddelelsen ... Hi, I would like to create a new xls file made of the content of ny current Sheet2 (not sheet1 or 3). is it possible? Many thanks, Dan |
creating new workbook from one sheet
Thank you Per
"Per Jessen" wrote: Hi Dan Try this: Sub CopySheet2ToNewWb() Dim wbA As Workbook Dim wbNew As Workbook With Application SheetsInWb = .SheetsInNewWorkbook .SheetsInNewWorkbook = 1 .DisplayAlerts = False .ScreenUpdating = False End With Set wbA = ThisWorkbook Set wbNew = Workbooks.Add wbA.Sheets("Sheet2").Copy wbNew.Sheets(1) wbNew.Sheets("Sheet1").Delete With Application .SheetsInNewWorkbook = SheetsInWb .DisplayAlerts = True .ScreenUpdating = True End With End Sub Regards, Per "Dan" skrev i meddelelsen ... Hi, I would like to create a new xls file made of the content of ny current Sheet2 (not sheet1 or 3). is it possible? Many thanks, Dan |
creating new workbook from one sheet
Hi Per
Bob's way is easier to make a workbook of one sheet but if you do it your way then there is no need to set the SheetsInNewWorkbook This will add a workbook with one sheet Set wbNew = Workbooks.Add(1) Or use Workbooks.Add(xlWBATWorksheet). -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Per Jessen" wrote in message ... Hi Dan Try this: Sub CopySheet2ToNewWb() Dim wbA As Workbook Dim wbNew As Workbook With Application SheetsInWb = .SheetsInNewWorkbook .SheetsInNewWorkbook = 1 .DisplayAlerts = False .ScreenUpdating = False End With Set wbA = ThisWorkbook Set wbNew = Workbooks.Add wbA.Sheets("Sheet2").Copy wbNew.Sheets(1) wbNew.Sheets("Sheet1").Delete With Application .SheetsInNewWorkbook = SheetsInWb .DisplayAlerts = True .ScreenUpdating = True End With End Sub Regards, Per "Dan" skrev i meddelelsen ... Hi, I would like to create a new xls file made of the content of ny current Sheet2 (not sheet1 or 3). is it possible? Many thanks, Dan |
All times are GMT +1. The time now is 09:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com