Excel separating VBA code sheet from worksheet after recovery

mrtph

New Member
Joined
Feb 9, 2018
Messages
1
Hi everyone,

I've tried searching the web for a reference to this situation but I haven't had much luck. Maybe someone has seen something similar before and can help me troubleshoot it?

I have a workbook with 8 sheets with 1 main sheet pulling information from the others. I have a function on that sheet that filters dropdown options using the .Validation function resulting in 4 options for the dropdown. The .Validation list is from a comma delimited string which strings together values that match certain criteria. The workbook works perfectly while it is open.

If I save the workbook while options 1, 3, or 4 are in the dropdown, I can close the workbook and reopen it just fine. If I save with option 2 and close the workbook, I get the error "We found a problem with some content in 'myfilename<insertfilenamehere>.xlsm'. Do you want us to try to recover as much as we can?" when trying to reopen the workbook. If I click "Yes", the workbook opens but the VBA code is now in a separate sheet from the worksheet that should be using it.

For example, the original workbook contained Sheet3 (Page 1) which contains my VBA code and the resulting worksheet. After recovery, there is a new sheet called Sheet4 (Page1) which only has the resulting worksheet without any buttons, dropdowns, or VBA code . It only has the values when it was saved. Sheet3 is shown by itself without the "(Page 1)" in the developer window but is not accessible as a tab in the recovered workbook. It still contains all the VBA code from before it was saved. Furthermore, Sheet3 now has the same icon as "ThisWorkbook".

I inserted a Workbook_Open() sub in "ThisWorkbook" with message boxes and those don't even fire before the error occurs.

Any help is greatly appreciated.</insertfilenamehere>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top