Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Unwanted sheet in VBE

0

I have only 1 sheet in excel, but in VBA editor there are 2 more (yellow highlight).

I put the picture in the attached file.

Please can anyone help to let me know what are these, how can I remove them

Appreciated

Answer
Discuss

Answers

0
Selected Answer

Tam

As Willie says, the ThisWorkbook object is in every Excel file and cannot be deleted.

The Sheet5 seems to be a shadow copy of that and I don't know how it was created. It's empty and does nothing but...

In the attached revised file, I've:

  1. copied all modules from your file
  2. copied your worksheet "macros" and:
  •      aligned/ resized all the buttons to give a neater, more uniform look
  •      assigned the correct macro to each button (to match the assignments in your file)..

As a consequence, you no longer have the mysterious Sheet5 in VB Project Explorer.

Hope this fixes your problem (given Excel's insistence on ThisWorkbook). If so, please be sure to mark this Answer as Selected. (Also, kindly act on my comments against your "Answer").

Discuss

Discussion

@John

You've done the work that I suggested Tam do. I too considered doing the same but decided to leave it for Tam to do as a learning experience.

Happy Holidays
WillieD24 (rep: 557) Dec 21, '23 at 9:43 am
@Willie - oops! Haven't had sufficient time to pay attention recently but a disruption to my plans today freed up some time so I decided to respond / help Tam. Happy holidays to you both! 
John_Ru (rep: 6142) Dec 21, '23 at 11:00 am
Thank you Willie and John for your great help
Tam (rep: 2) Dec 24, '23 at 8:45 pm
Thanks for selecting my Answer., Tam and have a Merry Christmas! 
John_Ru (rep: 6142) Dec 25, '23 at 1:32 am
Add to Discussion
0

 Hello Tam and welcome to the forum,

I have added a screenshot with notes to your file. (attached)

The "ThisWorkbook" object is present in all files and shows in the "VBAProject" window. Without getting technical, it basically represents the whole Excel file. It cannot be removed.

The "Sheet5" object is a worksheet. To view its properties, select it and scroll down to the "Properties" window. In your case, look at the last property - Visible. It is likely set to "xlSheetHidden" or "xlSheetVeryHidden". Change this to "xlSheetVisible" to see the worksheet in Excel. After the sheet is visible you can decide whether to keep it or delete it.

UPDATE - Dec. 20

Uploading your file has provided some good answers. Your situation is something I have never seen or heard of before. Your "Sheet5" is a copy/duplicate of the "ThisWorkbook" object. I don't know how this is possible. Totally bizarre. If you open the VB Editor and select "Sheet5" in the VBAProject window (top left) and then look at the Properties window (bottom left) you will notice the title reads "Properties – Sheet5" and the first line (Names) reads "ThisWorkbook"; it should read "Sheet5". Now select "ThisWorkbook" in the project window. Now look at the Properties window and you will notice everything is the same. The title should be "Properties – ThisWorkbook" but it reads "Sheet5"

If I were you, this is what I would do: Create a new Excel macro enabled (.xslm) workbook. In the VB Editor add 20 modules (like your "tools" file). Then, one-by-one, copy the code from old Module1 to new Module1, old Module2 to new Module2, etc. in the new workbook. Copy worksheet "macros" to the new workbook. Check each button on this new sheet to make sure each button is assigned to the macro in the new workbook and not the old (original) workbook. After verifying everything in the new workbook is as it should be, delete the original, and then rename the new workbook to "toosl.xslm"

I have updated my file to include screen shots of these oddities.

If this answers your question please mark my answer as Selected.

Cheers   :-)

Discuss

Discussion

Hi Will
I tried but was not able to find the visible property in the Sheet5, it seems the Sheet5 is not an normal object. I will upload the file in my post, would you help me to have a look.
Thanks
Tam (rep: 2) Dec 20, '23 at 11:26 am
Hi Tam,

See my update (Dec. 20) above.

Cheers   :-)
WillieD24 (rep: 557) Dec 20, '23 at 11:52 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login