954,262 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Excel 2007 - infinite code loop

Hi

I'm currently stuck in an infinite loop because of the code I've written and i can't stop the code, close excel etc. Basically the code runs after a cell change, displays a msgbox and then causes itself to run again, and while this is happening i can't do anything except close the msgbox, and then it starts all over again...

So is there a way to stop the code from running or to exit excel without losing recent changes that i have made?

Mr. Blank
Newbie Poster
7 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

Disable Macros security setting when you load Excel? That should enable you to get to the code & correct it.

Suspishio
Posting Virtuoso
Team Colleague
1,730 posts since Aug 2007
Reputation Points: 47
Solved Threads: 145
 

Macro security was disabled, but i couldn't get to the code or do anything while the code was running.

Mr. Blank
Newbie Poster
7 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 
Macro security was disabled, but i couldn't get to the code or do anything while the code was running.


That's srange. When you load excel (blank sheet), you can disable the use of macros. Then when you load your problem spreadsheet, the code should not be running.

Isn't that so?

-----------------------------------
Added:I recently had a simulation running across 7 PCs. It ran for 6 days on each PC and the combined statistics wre gathered and analysed. That's irrelevant! In the early days, I had to interrupt the VBA code and I used Ctrl+Alt+Break. Since you haven't mentioned this, have you tried it?

Suspishio
Posting Virtuoso
Team Colleague
1,730 posts since Aug 2007
Reputation Points: 47
Solved Threads: 145
 

That's srange. When you load excel (blank sheet), you can disable the use of macros. Then when you load your problem spreadsheet, the code should not be running.

Isn't that so?

Yeah, sorry that's right...

(The problem doesn't occur when my project loads, but when i was testing my code, and i have since corrected the code anyway)

The problem was that i was editing and testing my code for a project, and then i found myself in an accidental infinite loop which would not let me stop the code, do anything etc... i had done a bit of work which i didn't want to lose and i couldn't find a way to stop the code from running or saving and then closing Excel.

But anyway i had to close it and lost some of the work i had done...(i was saving regularly but didn't foresee this event)

However it would still be good to know if there is a way to get out of an infinite loop if it does ever happen again,(which it has since )

Because in VB6 i think you could pause/stop the code by pressing the pause/break key or the stop button (which in excel it wouldn't let me touch it. and neither did the pause key work).

thanks,


---------------------------------------------------------------
Oh i didn't read what you had added in your previous post.

i will have to try the Ctrl+Alt+Break. EDIT: (I did and it works.)

thanks for your help

Mr. Blank
Newbie Poster
7 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

You're welcome. Then mark the thread as SOLVED.

Cheers

Suspishio
Posting Virtuoso
Team Colleague
1,730 posts since Aug 2007
Reputation Points: 47
Solved Threads: 145
 
tipsen
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: