Niranjanrajrishi
Member
Code:
Sub MoveSheets()
Dim WB As Workbook, WS As Worksheet, SH As Worksheet
Dim newwb As Workbook
For Each WS In ThisWorkbook.Worksheets
If WS.Name <> "Macro" Then
If WB Is Nothing Then
WS.Move
Set WB = ActiveWorkbook
Else
WS.Move After:=SH
End If
Set SH = ActiveSheet
End If
Next WS
Set WB = ActiveWorkbook
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\Reconciliation" & "_" & Format(Date - Day(Date), "mmm-yy"), FileFormat:= _
51, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub
I am trying to move multiple sheets to new work book and then save. But in the attached code, the macro is trying to save to the Macro sheet itself.
My macro file create multiple sheets after certain formatting work then it moves to new workbook and save. But the coding does not save the new workbook which creates through the coding.