Excel 365 breaks a worksheet creating a same name class and a new worksheet with 1 at the end

Copper Contributor

I am building an Excel workbook app, with VBA code.

I have a specific problem in this workbook which replicates at random with a specific worksheet.

 

The problem is that this worksheet codenamed ITEMSTATEMENT suddenly appears as a Class, as you can see in the screenshots, and the original sheet content appears under a slightly different codename, ITEMSTATEMENT1. All VBA code is retained in the original Sheet (now a Class), which I can move to the newly created Sheet. But the VBA code does not work anymore as it refers to a different Microsoft Excel Object UNTIL I move it. This is unacceptable to anyone using the app as it suddenly loses functionality.

 

I have tried moving all sheets with the affected one from the bad workbook to a new one, moving all sheets except the affected one (which I create from scratch) to a new one, changing its codename and sheet name, to no avail.

 

Being a Class of the "ThisWorkbook" kind (its properties state ThisWorkbook as its (Name) property, although the original ThisWorkbook object is unaffected) I cannot remove it. I have tried all the above for at least 10 times and it is getting more frustrating since I am building more functionality into the Workbook and it takes more and more time to recover every time it happens, having to move/copy worksheets, code modules, classes, userforms etc.

 

Other than that the workbook is usable. Although I have seen this happen again and thus have 2 classes and a new worksheet.

 

Can anyone think of something? 

 

Excel Version 2110 (Build 14527.20276 Click-to-Run)

 

George_Thalassinos_0-1637094300337.png

George_Thalassinos_1-1637094352501.png

 

 

 

0 Replies