stop running code

G

Guest

I've got some real quick code that I used to refresh all my linked data so I
dont get any messages every time a chart changes. I would like to be able to
add some sort of a break in the code so it will stop if i tell it to. Can
anyone help me with this?

Here is my code:

sub macro1()
application.displayalerts = false

sheets("sheet1").select
range("a1").select
activeworkbook.refreshall
application.displayalerts = true
msgbox ("refresh complete")

end sub

Thanks,
Lou Sanderson
 
D

Dave Peterson

How about using ctrl-break or escape?

Take a look at application.EnableCancelKey in VBA's help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top