Pausing a Macro

ercedwards

Board Regular
Joined
Apr 27, 2013
Messages
125
I have a macro that scans a list of orders to find those belonging to a certain customer.

When it finds one it displays the order and then finds the next one.

What I need to macro to do is let me edit that order (i.e. edit what's on the screen) before carrying on to find the next one.

Is there a way to do that?

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Set a range name in your workbook called "lastOrderFound". This cell will contain a cell address.

Use the value of "lastOrderFound" as the starting point for the search.

Whenever the macro finds an order belonging to the customer, just update the value of lastOrderFound and stop the macro. When you restart, it will find the next one.

You may want your macro to re-set the value of lastOrderFound to the beginning of the search range after you reach the end.
 
Upvote 0
I have a macro that scans a list of orders to find those belonging to a certain customer.

When it finds one it displays the order and then finds the next one.

What I need to macro to do is let me edit that order (i.e. edit what's on the screen) before carrying on to find the next one.

Is there a way to do that?

Thanks


You're going to want to create a userform named "fstop"
On the userform put a label with the caption "Press continue after edit" or whatever you want
Also add a command button with the caption "continue"

after you've done this copy this into the userform code
Code:
Private Sub CommandButton1_Click()
Unload fstop
End Sub

then copy the following code into a module

Code:
Sub YourCode()



FIRST PART OF YOUR MACRO
 
Call Pauser
    
SECOND PART OF YOUR MACRO
 
End Sub

Sub Pauser()
Application.ScreenUpdating = True
fstop.Show
Do Until fstop.Visible = False
DoEvents
Loop
Application.ScreenUpdating = False
End Sub

Basically where you want the macro to pause is where you will split it in half with "Call Pauser" in the middle
That should do it.

*important* make sure the userform's "ShowModal" is set to false so that you can edit while the userform is up
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top