Excel 2013, Run-time error '1004' Delete method of Worksheet class failed

ChiChiR

New Member
Joined
Feb 9, 2014
Messages
14
I have a large file that was originally developed years ago, in Excel 2003 or maybe earlier. I am currently running Excel 2007 in my office, and the file is currently saved with 2007 in .xlsm format. Many of my users have more recent versions of Excel than we have and are running into problems with pieces of the extensive VBA code that work fine in 2007.

In this particular case, I have a string of 10 Sheets("sheetname").Delete statements. The first few are as follows:

Sheets("FTE ANALYSIS").Delete
Sheets("Supplemental Schedules A & B").Delete
Sheets("School Nurse Schedule C").Delete

The first statement works fine, but users with Excel 2013 are getting the run-time error '1004' Delete method of Worksheet class failed. I thought perhaps it was the ampersand in the sheet name, so I commented out that line. Again, the first one worked, but it errored on the "School Nurse" sheet.

I did some searching and found that someone had a similar issue that was caused by their sheets being VeryHidden, as opposed to just Hidden. My sheets are just Hidden, not VeryHidden, so that is not the issue here.

Does anyone know what is tripping me up? It work in 2007 and 2010 (at least, this piece does), but not in 2013.

Thank you!
Cece
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Maybe this as a different approach
Code:
Application.DisplayAlerts = False
Sheets(Array("FTE ANALYSIS", "Supplemental Schedules A & B", "School Nurse Schedule C")).Delete
Application.DisplayAlerts = True
 
Upvote 0
Pleasure ...glad it worked...(y)
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top