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?

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

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

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?

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

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

Cheers

1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.