Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Zorro
 
Posts: n/a
Default Macro to save sheets as separate workbooks

can anyone help with a macro to save each worksheet as a separate book
(named as its sheet name) to a given folder (C:\mydocs\myfolder)?

Many thanks
Zorro


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim newWks As Worksheet

For Each wks In activeworkbook.worksheets
wks.Copy 'to a new workbook
Set newWks = ActiveSheet
With newWks
Application.DisplayAlerts = False
.Parent.SaveAs Filename:="C:\mydocs\myfolder\" & .Name, _
FileFormat:=xlworkbooknormal
Application.DisplayAlerts = True
.Parent.Close savechanges:=False
End With
Next wks

End Sub

It also overwrites any existing file (if one exists).

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Zorro wrote:

can anyone help with a macro to save each worksheet as a separate book
(named as its sheet name) to a given folder (C:\mydocs\myfolder)?

Many thanks
Zorro


--

Dave Peterson
  #3   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Another one
http://www.rondebruin.nl/copy6.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Zorro" wrote in message . ..
can anyone help with a macro to save each worksheet as a separate book (named as its sheet name) to a given folder
(C:\mydocs\myfolder)?

Many thanks
Zorro



  #4   Report Post  
Zorro
 
Posts: n/a
Default

Thanks guys.

Zorro



"Ron de Bruin" wrote in message
...
Another one
http://www.rondebruin.nl/copy6.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Zorro" wrote in message
. ..
can anyone help with a macro to save each worksheet as a separate book
(named as its sheet name) to a given folder (C:\mydocs\myfolder)?

Many thanks
Zorro





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
Divide worsheet and save as separate files Colin Hayes Excel Worksheet Functions 0 June 28th 05 09:42 PM
Combine Workbooks as separate worksheets SAL Excel Discussion (Misc queries) 2 June 1st 05 04:30 PM
saving excel with multiple sheets, but won't save to proper sheet jimlead1 Excel Discussion (Misc queries) 0 May 4th 05 06:36 PM
WorkBooks In Separate Windows. Sam New Users to Excel 1 January 19th 05 12:08 AM
How do I save sheets in a workbook to separate files? Omzala Excel Worksheet Functions 2 January 13th 05 06:23 PM


All times are GMT +1. The time now is 03:40 PM.

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

About Us

"It's about Microsoft Excel"