PC Review


Reply
Thread Tools Rate Thread

creating new workbook from one sheet

 
 
Dan
Guest
Posts: n/a
 
      31st Dec 2008
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 With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      31st Dec 2008
Worksheets("Sheet2").Copy

--
__________________________________
HTH

Bob

"Dan" <(E-Mail Removed)> wrote in message
news:01D7B409-409E-4D85-AF2D-(E-Mail Removed)...
> 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 With Quote
 
Per Jessen
Guest
Posts: n/a
 
      31st Dec 2008
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" <(E-Mail Removed)> skrev i meddelelsen
news:01D7B409-409E-4D85-AF2D-(E-Mail Removed)...
> 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 With Quote
 
Dan
Guest
Posts: n/a
 
      31st Dec 2008
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" <(E-Mail Removed)> skrev i meddelelsen
> news:01D7B409-409E-4D85-AF2D-(E-Mail Removed)...
> > 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 With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      31st Dec 2008
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> skrev i meddelelsen
> news:01D7B409-409E-4D85-AF2D-(E-Mail Removed)...
>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save each sheet of multi-sheet workbook as a single-sheet workbook CTB Microsoft Excel Programming 3 17th May 2011 08:40 AM
Creating a list from another sheet or workbook walrus Microsoft Excel Misc 6 14th May 2010 09:31 AM
Re: Creating New Workbook from Sheet Gord Dibben Microsoft Excel Programming 8 19th Jan 2010 10:43 PM
Re: Creating New Workbook from Sheet Ron de Bruin Microsoft Excel Programming 2 18th Jan 2010 10:40 PM
creating a excel sheet and have it print out and also load theinformation into another workbook Bassman Microsoft Excel Programming 1 7th Apr 2009 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:28 AM.