Excel VBA balls up

Associate
Joined
23 Mar 2009
Posts
2,014
Location
Peterborough
Right guys made a bit of big boo boo I think and am hoping one of you geniuses can save me.

Yesterday was working on a bit of VBA code that I didn't finish so thought I'd comment it all out and save the document. Fine. Guess I didn't comment it all out and left some unfinished code hovering around for one of the sheets. This is a problem as I think it tries to run this code when it opens up the document which results in excel keeling over and crashing. Tried opening and repairing/extracting data which has given me all my modules back which is ok but I'm missing all the code for the sheets and all my formatting has gone. Is there any way I can get it all back or am I going to have to rebuild from the stuff I've managed to recover already? Sorry if it's a vague description, this is the first time I've used VBa in anger and it was all going so well until today.
 
Soldato
Joined
18 Oct 2002
Posts
2,910
Location
London
Create a new workbook and add the following VBA code:

Application.EnableEvents = False

Run the code, this will stop events firing automatically.

Open your work book and then change the code so it won't crash Excel any more. After that you will need to enable events again so change the code from False to True and run that code snippet.

Hope that made sense!
 
Associate
OP
Joined
23 Mar 2009
Posts
2,014
Location
Peterborough
Well it didn't go as planned had a massive faff a couple more crashes (not entirely sure why) but after a couple of stabs with your thing I have my spreadsheet back!!!!!!! I could bloody kiss you right now!!!

Thanks man!
 
Back
Top Bottom