Am getting an error message when trying to delete a worksheet in VBA, wondering where I'm going wrong in the code and/or what might be preventing it from working.
here is my code
here is my code
Code:
Workbooks("Data").Save
Workbooks("without Data").Sheets("Sheet1").Unprotect "Password"
Workbooks("without Data").Sheets("MainMenu").Activate
Application.DisplayAlerts = False
Workbooks("without Data").Sheets("Sheet1").Delete
Application.DisplayAlerts = True
Workbooks("Data").Sheets("Sheet1").Copy Before:=Workbooks("without Data")
Workbooks("Data").Close