how to export worksheets into seperate files

P

PeterRad

Hi,

I get a sent a workbook that has around 100 worksheets in it.
is it possible to export all of these worksheets out to new files with
the name of each new file to be that of the worksheet?

Pete.
 
D

Dave Peterson

With no validation...

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.Parent
.SaveAs Filename:="C:\temp\" & NewWks.Name
.Close savechanges:=False
End With
Next wks
End Sub
 
P

PeterRad

Thank you Very Much
that works great.

Pete.


Dave said:
With no validation...

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.Parent
.SaveAs Filename:="C:\temp\" & NewWks.Name
.Close savechanges:=False
End With
Next wks
End Sub
 
Top