Oprichnick
Board Regular
- Joined
- May 30, 2013
- Messages
- 69
Hello I have a vba routine which was performing well, but somehow stopped working and I can't figure out why.
A have a macro in a workbook that is used to break down another workbook called "Report" (xlsx) in several excel sheets. Although there is a workbook activation, it is breaking the first file (which contain the code) which I call "Splitter".
Thanks for your help,
Oprichnick
A have a macro in a workbook that is used to break down another workbook called "Report" (xlsx) in several excel sheets. Although there is a workbook activation, it is breaking the first file (which contain the code) which I call "Splitter".
Code:
Sub Splitting()
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Workbooks("Report.xlsx").Activate
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xls"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox ("The Splitting is Done")
End Sub
Thanks for your help,
Oprichnick