Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Let user break out of a big computation?

I have a Userform which contains two buttons. One buttons
says "Begin" and the other button says "Cancel".

If the user presses "Begin", my macro will begin processing a
potentially long computation. Once the computation begins,
can I allow the user to press the "Cancel" button to break
out of the big computation?? Is that possible?

Additionally, is it possible to display some sort of progress
bar to display a percentage which shows how much of the
computation is complete? Would I need some sort of plug
control for this? Or can I just simply update a text label on
the form to show percentage completed??

Thank you!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Let user break out of a big computation?

Hi

If your code knows how much is done and how much is left, then a progress
function is easy, simple percentage calculation.
http://spreadsheetpage.com/index.php...ndicator_demo/

If you know the steps but not the time, this is a good way of visualizing
the progress:
http://www.dailydoseofexcel.com/arch...-progress-bar/

As for stopping the procedure, here is a very simple demo. All it does is
count up in the statusbar (lower left corner of Excel):

Option Explicit

Dim StopIt As Boolean

Sub BtnStartCode()
Dim m As Long, n As Long
StopIt = False
For m = 1 To 10000
DoEvents
If StopIt = True Then Exit Sub
For n = 1 To 999
Application.StatusBar = m * 1000 + n
Next
Next
End Sub

Sub BtnCancelCode()
StopIt = True
End Sub

HTH. Best wishes Harald


"Robert Crandal" wrote in message
...
I have a Userform which contains two buttons. One buttons
says "Begin" and the other button says "Cancel".

If the user presses "Begin", my macro will begin processing a
potentially long computation. Once the computation begins,
can I allow the user to press the "Cancel" button to break
out of the big computation?? Is that possible?

Additionally, is it possible to display some sort of progress
bar to display a percentage which shows how much of the
computation is complete? Would I need some sort of plug
control for this? Or can I just simply update a text label on
the form to show percentage completed??

Thank you!



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
Age computation owen.cxy Excel Programming 1 June 23rd 09 07:26 AM
Date Computation sylink[_3_] Excel Programming 1 November 20th 08 08:00 PM
Overtime computation and lunch break formula with IF and AND navychef Excel Worksheet Functions 4 December 8th 05 07:06 AM
links in cells break and revert to user profile location heathy Excel Discussion (Misc queries) 0 October 24th 05 05:37 PM
User initiated break/actions during macro execution mbarron Excel Programming 1 September 29th 04 05:35 PM


All times are GMT +1. The time now is 05:57 PM.

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

About Us

"It's about Microsoft Excel"