ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Convert excel worksheets into new workbooks (new files) (https://www.excelbanter.com/setting-up-configuration-excel/55823-convert-excel-worksheets-into-new-workbooks-new-files.html)

G

Convert excel worksheets into new workbooks (new files)
 
I have an excel file that contains 80 worksheets. I want to automatically
convert each worksheet into own new excel file. How can I do that without
copying and pasting?

Dave Peterson

Convert excel worksheets into new workbooks (new files)
 
Maybe some sort of macro:

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
wks.Copy 'to a new workbook
With ActiveSheet
.Parent.SaveAs Filename:="C:\temp\" & .Name, _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
Next wks

End Sub

Make sure C:\temp\ already exists (or change the code to point at an existing
folder)

G wrote:

I have an excel file that contains 80 worksheets. I want to automatically
convert each worksheet into own new excel file. How can I do that without
copying and pasting?


--

Dave Peterson

G

Convert excel worksheets into new workbooks (new files)
 
Thanks Dave!! I appreciate your quick response! I tested the script and it
works!!

"Dave Peterson" wrote:

Maybe some sort of macro:

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
wks.Copy 'to a new workbook
With ActiveSheet
.Parent.SaveAs Filename:="C:\temp\" & .Name, _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
Next wks

End Sub

Make sure C:\temp\ already exists (or change the code to point at an existing
folder)

G wrote:

I have an excel file that contains 80 worksheets. I want to automatically
convert each worksheet into own new excel file. How can I do that without
copying and pasting?


--

Dave Peterson



All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com