I had an error in my code that I have since corrected but it made a bunch of sheets objects while it was running that I didn't notice. The sheets are not simply hidden, they don't exist in the Excel frontend and can't be unhidden.
normally I just write a code like sheet15.delete and let the VBA takes care of this kind of thing for me. But these sheets can't seem to be deleted that way. I've also checked the window setting on the view tab in Excel and the unhide option is greyed out.
I've also saved the workbook as xlsx, stripping out the VBA, with intention of importing the VBA back in from backups. But before I can even inport the VBA, the sheets are listed in the VBA editor of the xlsx file. Very frustrating and weird.
Any idea how I can delete these false sheets without starting a new project and just importing the forms?
too many sheeeeeets
Open the VBA editor and click on one of the hidden sheets. In the VBA editor there should be a properties panel, usually under the project explorer, look at the visible property and set it to "1 - xlSheetVisible." 0 is a normal hidden sheet and 2 is a very hidden sheet. Nothing can be done to a very hidden sheet.
Related
In Excel, when opening the list of macros, there are some invalid entries. How to get rid of them?
Background:
I have an extended VBA library, containing a lot of UDFs and subs. I have added descriptions for UDFs using macro options. Maybe i created these invalid entries accidently in the past by a sub, which parses my code modules and generates descriptions for UDFs if this is provided via comments in the code module. This works fine now.
The invalid entries are actually the names of UDFs which do not exist anymore. They should not have appeared unter macros at any time, but again, maybe I messed up in the past.
I also would like to add some description to macros that do exist - but apparently that is only possible for UDFs?
Clarifications:
There is only this one workbook open. These are not macros of a different workbook. I selected "This Workbook only" for list of macros anyway.
There are no addins.
In VBE under Macros these invalid entires do NOT appear.
In Excel, under Developer Tools->Macros they DO appear.
In Excel, under Developer Tools->Macros, I can not edit or delete or execute these entries. Delete is greyed out, edit and execute lead to a popup error saying: "Der Bezug ist ungültig."
If you are referring to the Macro dialog that opens when clicking View > Macros, then note that there is a drop-down with which you can filter to show macros from a particular workbook only.
Use this to find where the "invalid" macros live, then edit that workbook and handle the macros from there (fix them or remove them).
The Macro dialog box that opens from the Developer tab lists all macros in "All open workbooks" by default. In the dropdown that shows this selection you can select to show macros in only a specific workbook. The reverse of this coin is that you can know exactly where any listed macro is located.
There are buttons to the right of the list which allow you to Edit or Delete any of the listed macros. The Edit button will take you to the module where the macro is stored.
There is also an Options button. When you click that another dialog box opens where you can set shortcuts as well as add a description. You can add a description to any listed macro, whether it's used as UDF or otherwise.
I wonder what would happen if a description exists for a macro that has been deleted. If such a situation is supported by Excel pressing the Delete button should rectify it.
I found an answer on microsoft.com:
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_winother-mso_2016/cannot-delete-macros/8e9072ae-ad95-49cb-952c-3a50b746d0d2
So it appears my workbook got somehow "corrupted". As I said, I did play with it quite a bit during development. So what I did to fix it:
Export all code modules.
Save workbook as .xlsx under a different name.
Open this cleaned xlsx and save it as xlsm again.
Imported all code modules into this cleaned xlsm.
Manually copied code in worksheet from corrupted version to clean version.
Now the macros are gone in the cleaned version.
Can anyone please help me with excel issue. I have created a dynamic dashboard in excel using sumifs on data layer and index match functions on presentation layer. I have placed a simple List box form control with no VBA or macro.
My dashboard was working fine, without any issue, but on final step I was just trying to make the List box control float on the sheet with scrolling.
I found a vba code, I opened vba from developer mode, pasted code, but that deleted same.
Since then upon any selection of List box item, it is giving me error “ Cannot run the macro Listbox4_Change. The macro May not be available in this workbook or all macros disabled.”
I have tried pretty much every thing I found on google. Created a macro and deleted, copied one line code in all sheets of vba and deleted, enabled Macro security setting, but nothing really is working .
I am stuck badly.
It sounds like you've added a macro and then removed it, but haven't removed the macro assignment on the list box.
Right-click on the control and choose Assign Macro, delete the Macro name, and hit OK.
I am getting an error when opening excel: We found a problem with some content in XXX. Do you want us to try and recover as much as we can? if you trust he source of this workbook, click Yes."
clicking Yes, "fixes" the issue but deletes a lot of VBA code, two weeks worth.
Whatever the issue it was introduced yesterday, I do not want to redo two weeks worth of coding. Is there anyway I can view what was removed, or open the VBA in notepad++ or something without opening the excel?
I opened another excel workbook and tried all the different options for the argument XlCorruptLoad in the Workbooks.Open to open the corrupt workbook. I noticed that there were two non existing sheets created in the project explroer of the corrupt workbook that had the code in there. I am not sure if it did that s a result of what I did or it was there all along and I did not notice it
Note that the reason I had a corrupted data is because the code was extracting a list and putting it in a cell validation formula..i guess I overloaded it.
I have been struggling with a strange thing in MS Excel 2010 xlsx file.
Excel works just fine with workbooks except one:
Excel freezes when on mouse click on cell.
This is a sheet-specific thing, because when I delete sheet, the thing is gone.
Also keyboard navigation arrows work as expected.
I've deleted all data, content, text from this worksheet, however it keeps freezing when I click on specific column.
I've checked also macros in dev tab, => all is clear
Also there are no any data connections etc...
Any suggestions appreciated.
that sheet might have all cells formatting
1.select all cells
2.clear all formatting
save and close it
I cannot get rid of these extra sheets in excel vba. only the sheets with a name exist.
I had exactly the same problem. I used the option Book Inspection in the Information Menu, then I selected remove hidden objects and it luckily worked. See the image attached, my excel is in Spanish so maybe the option is not really called "Book inspection" in the English version.
Hope this is useful.
Pd- Unhide the legitimate sheets because it will delete all hidden sheets. I suggest trying it in a copy of the book. Menu Option