Please wrap code next time
Try this:
Sub CreateBooks()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim sht As Worksheet
Dim sht2 As Worksheet
Dim fPath As String
Workbooks.Open fileName:="C:\exp1.xls"
Set wb1 = ActiveWorkbook
fPath = Left(wb1.FullName, Application.WorksheetFunction.Find(wb1.Name, wb1.FullName) - 1)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each sht In wb1.Sheets
Workbooks.Add
Set wb2 = ActiveWorkbook
sht.Copy Before:=wb2.Sheets(1)
For Each sht2 In wb2.Sheets
If sht2.Name <> sht.Name Then
sht2.Delete
End If
Next sht2
wb2.Sheets(sht.Name).Name = "Sheet1"
wb2.SaveAs fileName:=fPath & Left(sht.Name, Len(sht.Name) - 3)
Next sht
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
ska
Bookmarks