Forum Discussion
jerry wheatley
May 19, 2018Copper Contributor
Delete an EXCEL worksheet
I have a large EXCEL workbook with multiple worksheets. One of the sheets seems to be corrupt. If I select the corrupt sheet to delete my workbook is immediately closed before I can delete the corrupt sheet. Is there a way of deleting the sheet where I do not have to select it?
4 Replies
Sort By
- Haytham AmairahSilver Contributor
Hi Jerry,
What the type of the closing?
Is it a normal closing or crashing?
Have you any macro stored in the workbook?
I don't think that the worksheet is corrupted, but maybe there is a macro associated with the event of activating this worksheet, so it will close the workbook when you select the worksheet.
- jerry wheatleyCopper Contributor
Thank you for your response to my message. While I do not use macros, I do utilize a number of EXCEL functions (sumifs, vlookup, countif, etc.). I also ran several virus and malware detection scans, none were found. When the workbook closes it is immediate, I would classify it as crashing. Strange, there are probably 50 worksheets in this workbook. You can select any other tab and the workbook functions normally. Open this one and it will immediately crash each time; which is why I was determined to simply delete the sheet and then recreate it; but I cannot delete it, the crash is immediate and does not allow me enough time to delete the sheet normally. I was hoping there was a way to delete a sheet without opening it.
Thank you again for considering ways you are aware of to resolving this problem.
jerry wheatley
- Haytham AmairahSilver Contributor
Ok, please try this solution:
- Open the workbook
- Press Alt+F11 to open the Visual Basic for Applications editor
- Put this command in the Immediate window: Thisworkbook.Worksheets("SheetName").Delete
- If the Immediate window isn't visible, press Ctrl+G to show it.
- Please replace the SheetName in the command with the real sheet name.
- Press Enter