sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,404
- Office Version
- 2016
- Platform
- Windows
I'm using this to save a copy of the existing workbook, open it and then I'm trying to delete specific sheets in the newly created workbook but I'm getting an error 424, object required on the line that deletes the worksheet. Anyone help me understand why?
VBA Code:
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\Test Save.xlsm"
SavedWB = ThisWorkbook.Path & "\Test Save.xlsm"
Application.Workbooks.Open SavedWB
SavedWB.Worksheets("SETUP").Delete
SavedWB.Worksheets("HISTORICAL").Delete
SavedWB.Worksheets("FULLDATA").Delete
SavedWB.Worksheets("STAFF").Delete
SavedWB.Worksheets("SUMMARY").Activate
SavedWB.Save
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True