index > Visual Basic for Applications (VBA) > How to stop a never ending loop

How to stop a never ending loop


Hi,

Is there a command to stop a executed function. It happends that I sometimes created loops that countious for ever. I have so far had to quit excel to make it stop. But I guess there some command to stop this process.

Anyone that knows this?

Thanks in advance.

\Jonas




JS
Jonas.S

Hi Jonas

You need to look at the EXIT command so that you can jump out of the loop if certain conditions are met. It would probably be better to re-engineer your code so that you do not get stuck in the loop, if possible.




ADG
ADG
Thanks for your replay. But it wasn't the problem. I meant if I execute a macro and it's, off course by mistake a never ending loop in that macro how can a stop that macro? At the moment I'm using Ctrl+Alt+Delete to end Excel but I'm sure that it has to be a way to just stop the macro. In matlab for instance I think it's Ctrl+c. \Jonas


JS
Jonas.S
I think Ctrl-Break does what your looking for... if not try Shift-Break or Alt-Break or Punch-Kick-Break


www.dsmyth.net/blog
Derek Smyth

Thanks Derek,

Ctrl + Break did it.

Kind regards

\Jonas




JS
Jonas.S
reply 5

You can use google to search for other answers

 

More Articles

• check if workbook is open
• beforeClose event bringing up compile error...
• how can i copy my total from sheet 1 to sheet 2 and so on
• Need help with a macro (not sure if correct site... thx)
• Check the feasibility to program with the PowerPoint's presenter'...
• Close excel
• Data from serial port
• winHTTP access to secure ASP site?
• I dont know whether you have come across this..
• Programatically Add Pages to MultiPage Control
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• Word.Application
• Programming with MULTIPAGE
• VB Postgres connection problem
• Task Scheduler
• Help! Math problem
• Distribute elements extracted from XML
• Browsing Selection.InlineShapes forces W
• how to add CheckBox?
• Passing commands to unix from VBA EXCEL
• What language was Microsoft Word develop
• Textbox won't keep new values after work
• Need help with VBA project, need it to t
• Left and Right Margins in special cases
• OleDbConnection to Excel
• Using HTML Help in Microsoft Excel VBA

Hot Articles

• Creating MROUND function
• 'Call was rejected by callee' using VBA
• Call Windows API to store hyperlink path
• Help with interface?
• Problem regarding VBA in excel - Combine
• Adding minimize button to userform in de
• is it possible to get windows Services w
• VBA WORKSHEET
• Excel Server Using VBA
• html tag not working
• Access Project and Views
• report won't run
• A Control's Visible property does make t
• InputBox() in MS Word form textbox.
• assigning event handler subs to a dynami

Recommend Articles

• VBA Syntax
• automatical start macro in access2003
• DLookup help?
• Lock against application event log preve
• Automatic BCC from Outlook (VBA)
• VBA code in Dutch
• Get Excel Sheet Names
• Word Macro and Template File
• How do I write this!!
• partly remove the code from VBComponents
• Moving Mail Items from Outlook through V
• ADO Recordsets
• How print picture
• When to program in VBA and when not to???
• winHTTP access to secure ASP site?