Catastrophic failure - replaces all code with a subroutine I didn't write

rizzo93

Active Member
Joined
Jan 22, 2015
Messages
299
Office Version
  1. 365
Well this is new. :mad:

My spreadsheet was working fine last night. This morning I open it up and all my VB code is gone. Upon looking at the worksheets in the VB editor, every one of them says this:

VBA Code:
Sub Macro1()
'
' Macro1 Macro
'

'
    Selection.EntireColumn.Hidden = False
End Sub

I didn't write that code. But even if I did, I would not have placed it in every worksheet.

This all started when I tried running a macro which produced this error message:

System error &H80070057 (-2147024809). The parameter is incorrect.

When searching on that message yielded little help, it motivated me to dig further and that's when I found all my code had been replaced. In times like this, I try resaving it as another file, but Excel couldn't even do that citing that the file was too damaged to save anything.

I'm going to try to copy/paste my code from a backup file to see if that solves the problem. But what on earth would cause such a thing and can it be prevented?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Did you try opening up in safe mode?

hold the cntrl key, right click and choose "Open" Does the code return?
 
Upvote 0
Did you try opening up in safe mode?

hold the cntrl key, right click and choose "Open" Does the code return?
Hey gitmeto, thanks for replying.

No, I haven't tried that. Actually, I managed to build off a backup of the file. So far, it's working fine. I still don't know how this happened, but I'll keep your suggestion in mind should something like this occur again. Cheers!
 
Upvote 0

Forum statistics

Threads
1,214,853
Messages
6,121,935
Members
449,056
Latest member
denissimo

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