Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a list from another sheet or workbook walrus Excel Discussion (Misc queries) 6 May 14th 10 09:31 AM
Creating a new sheet from specific data in existing sheet Rosscoe Excel Discussion (Misc queries) 2 January 13th 10 03:07 PM
Creating form on sheet 1 and having info move to sheet 2 SHARON Excel Discussion (Misc queries) 4 June 1st 09 05:01 PM
Creating new sheet named one week newer that active sheet davegb[_2_] Excel Programming 6 March 25th 08 12:21 AM
Q: Creating a macro to sort and group columns in a sheet according to another sheet [email protected] Excel Programming 0 January 8th 07 09:06 PM


All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"