Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Create a workbook from every worksheet in your workbook

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 896
Default Create a workbook from every worksheet in your workbook

Sub cus()
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
Next
End Sub

On 10 Lis, 08:37, vicky 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Create a workbook from every worksheet in your workbook

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" skrev i meddelelsen
...
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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 896
Default Create a workbook from every worksheet in your workbook

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 wrote:
Sub cus()
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
Next
End Sub

On 10 Lis, 08:37, vicky 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.- Ukryj cytowany tekst -


- Pokaż cytowany tekst -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Create a workbook from every worksheet in your workbook

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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Create a workbook from every worksheet in your workbook

hey got it . chdir thisworkbook.path :)
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Create a workbook from every worksheet in your workbook

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
wrote:

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


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Create a workbook from every worksheet in your workbook

See also
http://www.rondebruin.nl/copy6.htm

--

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


"vicky" wrote in message ...
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
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
want to create a link to another worksheet in another workbook pkt Excel Worksheet Functions 1 October 27th 09 01:04 AM
Create new workbook and new worksheet and close. Worksheet not saved Patrick Molloy Excel Programming 0 July 25th 09 07:00 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Excel Programming 0 July 21st 09 02:19 PM
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Excel Worksheet Functions 0 July 20th 09 07:10 PM
How can I create multiple rows of worksheet tabs in a workbook? kdzugan Excel Discussion (Misc queries) 1 March 8th 05 03:13 PM


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

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"