PC Review


Reply
Thread Tools Rate Thread

Create a workbook from every worksheet in your workbook

 
 
vicky
Guest
Posts: n/a
 
      10th Nov 2009
i have a workbook name test1 which contain 3 sheets named
"aa","bb","cc" .now i need a macro which loop thru test1 workbook and
should create 3 new workbooks with name "aa" ,"bb", "cc" and should
contain data present in their respective sheets.
 
Reply With Quote
 
 
 
 
Jarek Kujawa
Guest
Posts: n/a
 
      10th Nov 2009
Sub cus()
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
Next
End Sub

On 10 Lis, 08:37, vicky <vimalbarl...@gmail.com> wrote:
> i have a workbook name test1 which contain 3 sheets named
> "aa","bb","cc" .now i need a macro which *loop thru test1 workbook and
> should create 3 new workbooks with name "aa" ,"bb", "cc" and should
> contain data *present in their respective sheets.


 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      10th Nov 2009
Hi

This should do it:

Sub CopyShToNewWb()

Dim NewWb As Workbook
For Each sh In ThisWorkbook.Sheets
shName = sh.Name
sh.Copy
Set NewWb = ActiveWorkbook
NewWb.SaveAs Filename:=shName
NewWb.Close
Next
End Sub

Regards,
Per

"vicky" <(E-Mail Removed)> skrev i meddelelsen
news:c975b8ed-a750-4ae4-a1c1-(E-Mail Removed)...
>i have a workbook name test1 which contain 3 sheets named
> "aa","bb","cc" .now i need a macro which loop thru test1 workbook and
> should create 3 new workbooks with name "aa" ,"bb", "cc" and should
> contain data present in their respective sheets.


 
Reply With Quote
 
Jarek Kujawa
Guest
Posts: n/a
 
      10th Nov 2009
ooop!

sorry, forgot about saving new workbooks

Sub cus()
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
With ActiveWorkbook
.SaveAs (Sheet.Name)
.Close
End With
Next
End Sub

On 10 Lis, 09:05, Jarek Kujawa <bli...@gazeta.pl> wrote:
> Sub cus()
> For Each Sheet In ThisWorkbook.Sheets
> Sheet.Copy
> Next
> End Sub
>
> On 10 Lis, 08:37, vicky <vimalbarl...@gmail.com> wrote:
>
>
>
> > i have a workbook name test1 which contain 3 sheets named
> > "aa","bb","cc" .now i need a macro which Â*loop thru test1 workbookand
> > should create 3 new workbooks with name "aa" ,"bb", "cc" and should
> > contain data Â*present in their respective sheets.- Ukryj cytowany tekst -

>
> - Pokaż cytowany tekst -


 
Reply With Quote
 
vicky
Guest
Posts: n/a
 
      10th Nov 2009
thanku a lot ppl.
but i have a another issue . i want to save the newly created
workbooks in thisworkbook path .


 
Reply With Quote
 
vicky
Guest
Posts: n/a
 
      10th Nov 2009
hey got it . chdir thisworkbook.path
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      10th Nov 2009
Sub Make_New_Books()
Dim w As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In ActiveWorkbook.Worksheets
w.Copy
With ActiveWorkbook
.SaveAs FileName:=ActiveWorkbook.Path _
& "\" & w.Name & ".xlsx"
.Close
End With
Next w
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 10 Nov 2009 01:14:06 -0800 (PST), vicky <(E-Mail Removed)>
wrote:

>thanku a lot ppl.
> but i have a another issue . i want to save the newly created
>workbooks in thisworkbook path .
>


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      10th Nov 2009
See also
http://www.rondebruin.nl/copy6.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"vicky" <(E-Mail Removed)> wrote in message news:c975b8ed-a750-4ae4-a1c1-(E-Mail Removed)...
>i have a workbook name test1 which contain 3 sheets named
> "aa","bb","cc" .now i need a macro which loop thru test1 workbook and
> should create 3 new workbooks with name "aa" ,"bb", "cc" and should
> contain data present in their respective sheets.

 
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
want to create a link to another worksheet in another workbook pkt Microsoft Excel Worksheet Functions 1 27th Oct 2009 01:04 AM
Create new workbook and new worksheet and close. Worksheet not saved Patrick Microsoft Excel Programming 1 25th Jul 2009 07:00 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Microsoft Excel Programming 0 21st Jul 2009 02:19 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Microsoft Excel Worksheet Functions 0 20th Jul 2009 07:10 PM
Copy Excel Worksheet to new Workbook via VBA without Links to original Workbook JamesDMB Microsoft Access Form Coding 0 21st Mar 2007 06:13 PM


Features
 

Advertising
 

Newsgroups
 


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