Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to get the code to delete a sheet, save, then close the
workbook. Right now it deletes the sheet, saves but then I get a Run time Error "9" subscript out of range. I have the code below. Please tell me what I am doing wrong. Private Sub workbook_beforeclose(cancel As Boolean) Application.DisplayAlerts = False ActiveWorkbook.Sheets("sheet1").Delete Application.DisplayAlerts = True ActiveWorkbook.Save ActiveWorkbook.Close End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error - Subscript out of range despite On Error statement | Excel Programming | |||
runtime error: syntax error or access violation | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
naming tab macro error runtime error 1004 | Excel Programming | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |