Oprichnick
Board Regular
- Joined
- May 30, 2013
- Messages
- 69
Hello,
I built this piece of code which is intended to rename each worksheet in XYZ Workbook and split them into new workbooks.
Indeed it is created a new workbook for each tab. However each of them is a full copy of the source workbook and not just of the sheet.
What I'm missing here?
Thanks,
Oprichnick
I built this piece of code which is intended to rename each worksheet in XYZ Workbook and split them into new workbooks.
Indeed it is created a new workbook for each tab. However each of them is a full copy of the source workbook and not just of the sheet.
What I'm missing here?
Code:
Sub Splittingv2()
Dim wks As Worksheet
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
With Workbooks("XYZ.xls")
For Each wks In .sheets
With wks
If .Range("E16").Value <> "" Then .Name = Left(.Range("E16").Value, 3)
End With
Next wks
End With
With Workbooks("XYZ.xls")
For Each wks In Workbooks("DLQ.xls").Worksheets
With wks
.SaveAs Filename:="C:\Path\" & wks.Name & ".xls"
End With
Next wks
End With
MsgBox ("The Splitting is Done")
End Sub
Thanks,
Oprichnick