Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove a non-existant Sheet in VBA

Tags:

excel

vba

I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that.

These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them from the VBA portion? Remember, these sheets don't actually exist so it's not like I can just right click on them within Excel and select Delete. I did try right clicking on the sheet in VBA and select Remove Sheet, but that option is greyed out. Actually remove sheet is greyed out on all sheets, even those that do exist. The spreadsheet is not protected in any way either.

These sheets aren't causing any issues, more of an annoyance since I know they aren't physically there and I have no way to remove them from VBA.I have attached a picture of what I am looking at. The sheets that I am trying to remove are Sheet10, Sheet11, and Sheet9.

enter image description here

like image 283
Chris Avatar asked Jun 30 '14 19:06

Chris


2 Answers

I had that same situation once. The only solution I found was to copy all of the "real" worksheets to a new workbook. I'm guessing the original workbook got corrupted somehow.

like image 156
Ron Rosenfeld Avatar answered Oct 11 '22 17:10

Ron Rosenfeld


I solved a problem like this doing the next steps:

  1. Backup your file in other place
  2. Change the extension .xlsm to .zip
  3. Extract the zip file
  4. Go to /xl folder
  5. Open workbook.xml in notepad
  6. In some place there was each "gost" Sheet with the parameter hidden. Replace full command parameter by nothing (I don't remember the structure. Something like 'state:"hidden"'. Erase all of this)
  7. Compact all files and folders extracted as ZIP.
  8. Rename the zip file as .xlsm
  9. Open and see if it's resolved
like image 36
Leandro Teixeira Avatar answered Oct 11 '22 16:10

Leandro Teixeira