Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Is there an "On Break" similar to "On Error"?

I know Excel has an "On Error" function, but is there such a thing as
On Break or On Reset or On Quit or something of that sort? My code
changes Excel's Calculation to Manual and changes it back to Automatic
at the end. There's also an On Error function that changes it back to
Automatic if there's an error in the code.

But sometimes I step through my code and hit Reset, and in this case
the Calculation stays in Manual mode. Is there a way I can change it
back to Automatic when I hit Ctrl+Break or Reset?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Is there an "On Break" similar to "On Error"?

Nope... When you interupt the code you need to manually restore the settings.
--
HTH...

Jim Thomlinson


"Chris" wrote:

I know Excel has an "On Error" function, but is there such a thing as
On Break or On Reset or On Quit or something of that sort? My code
changes Excel's Calculation to Manual and changes it back to Automatic
at the end. There's also an On Error function that changes it back to
Automatic if there's an error in the code.

But sometimes I step through my code and hit Reset, and in this case
the Calculation stays in Manual mode. Is there a way I can change it
back to Automatic when I hit Ctrl+Break or Reset?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Is there an "On Break" similar to "On Error"?

No, but you can execute the command from the Immediate window.. i.e., enter
this in the command window and then press enter

application.Calculation=xlCalculationAutomatic


--
Hope that helps.

Vergel Adriano


"Chris" wrote:

I know Excel has an "On Error" function, but is there such a thing as
On Break or On Reset or On Quit or something of that sort? My code
changes Excel's Calculation to Manual and changes it back to Automatic
at the end. There's also an On Error function that changes it back to
Automatic if there's an error in the code.

But sometimes I step through my code and hit Reset, and in this case
the Calculation stays in Manual mode. Is there a way I can change it
back to Automatic when I hit Ctrl+Break or Reset?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Is there an "On Break" similar to "On Error"?

On Aug 7, 11:32 am, Vergel Adriano
wrote:
No, but you can execute the command from the Immediate window.. i.e., enter
this in the command window and then press enter

application.Calculation=xlCalculationAutomatic

--
Hope that helps.

Vergel Adriano

"Chris" wrote:
I know Excel has an "On Error" function, but is there such a thing as
On Break or On Reset or On Quit or something of that sort? My code
changes Excel's Calculation to Manual and changes it back to Automatic
at the end. There's also an On Error function that changes it back to
Automatic if there's an error in the code.


But sometimes I step through my code and hit Reset, and in this case
the Calculation stays in Manual mode. Is there a way I can change it
back to Automatic when I hit Ctrl+Break or Reset?


Thanks for the help, guys. I think I'll take Vergel's advice and
create a comment stating that if the code doesn't run all the way
through, run <application.Calculation=xlCalculationAutomatic in the
Immediate window. It's crude, but it should get the job done.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Is there an "On Break" similar to "On Error"?

You can have your code look for a ctrl-break.

Check out
application.EnableCancelKey
in VBA's help.

This won't help you if you hit the Reset button, though.

Chris wrote:

I know Excel has an "On Error" function, but is there such a thing as
On Break or On Reset or On Quit or something of that sort? My code
changes Excel's Calculation to Manual and changes it back to Automatic
at the end. There's also an On Error function that changes it back to
Automatic if there's an error in the code.

But sometimes I step through my code and hit Reset, and in this case
the Calculation stays in Manual mode. Is there a way I can change it
back to Automatic when I hit Ctrl+Break or Reset?


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
What is Error "Method "Paste" of object "_Worksheet" failed? vat Excel Programming 7 February 17th 06 08:05 PM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"