I am trying to abort a loop function when a blank cell condition is met but then receive
"Run time error 1004: method 'save as object' workbook failed".
It works fine, but somehow the macro breaks on the
wbMaster.SaveAs ("C:\Users\folder\Desktop\" & ActiveCell.Value & ".xls")
line. I use If (IsEmpty(ActiveCell)) Then Exit Sub
thinking it will abort the macro after the condition is met but still no luck.
Let me know what you guys think about my script below. Any advice will be greatly appreciated.
Sub Manipulate()
Dim wbMaster As Workbook
Dim wbLocal As Workbook
Set wbLocal = ThisWorkbook
If (IsEmpty(ActiveCell)) Then Exit Sub
Do Until ActiveCell.Value = ""
Set wbMaster = Workbooks.Open("C:\Users\folder\Desktop\Output.xlsx")
wbLocal.Worksheets("Input").Activate
wbMaster.Worksheets("Output").Range("B3").Value = ActiveCell.Value
wbMaster.SaveAs ("C:\Users\folder\Desktop\" & ActiveCell.Value & ".xls")
wbMaster.Close True
ActiveCell.Offset(1, 0).Select
Loop
MsgBox "Export Finished"
End Sub