entering cell values while a macro is running

oldbrewer

Well-known Member
Joined
Apr 11, 2010
Messages
11,012
Is it possible to have th emacro pause in some way and hand control to the keyboard and then resume running after say 10 seconds ?
 

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.
Code:
Application.Wait(Now + #0:00:10#)

Nevermind...ignore me...that doesn't give you control.
 
Last edited:
Upvote 0
Is it random when you would want to stop it? Or is it always in a specific place in the code?

If the code is not that long you could manually run the code using F8 and its dynamic where you stop.

If its a specific place you can put a

Code:
Stop
(have VBA open for this)
In the code where you would like to change something, and do the change, and press "F5" again..
 
Last edited:
Upvote 0
thanks - there is a definite place in the code where I want to check if say cell A1 is still empty, but to get a value into A1 I need to "stop" the macro - can a macro be made to pass or offer control to the keyboard ?
 
Upvote 0
Ok, so you don't want to stop the macro, you just want to populate A1.

Code:
If IsEmpty(Cells(1, 1)) Then    
     Cells(1, 1).value = InputBox("A1 is not populated. Please populate it.")
Else
    'do nothing
End If
 
Upvote 0
many thanks, the macro will run for maybe 5 minutes before I want to put a value into A1 - maybe I am not explaining the situation clearly enough. As soon as there is a value in A1 the macro does a number of things before terminating. It is how I can get a value into A1 while the macro is running ?
 
Upvote 0
So at the point of where you want to break the code, put that code in there. This will prompt for user input. It's the same as passing control to the user.
 
Upvote 0
So at the point of where you want to break the code, put that code in there. This will prompt for user input. It's the same as passing control to the user.
He is correct. As long as the only value you would like to change is "A1" =)

What code runs for five minutes tho, I think that can be sped up, you have dimmed it, and hid application updates etc?
 
Upvote 0
the code generates bingo numbers for my 2 grandchildren and needs to give them time to tick off the numbers - so when one calls bingo I want to populate A1 which will divert the macro to checking routine - I am using excel 2000 and have managed to use speech to call out the numbers.....
 
Upvote 0
thanks - there is a definite place in the code where I want to check if say cell A1 is still empty, but to get a value into A1 I need to "stop" the macro - can a macro be made to pass or offer control to the keyboard ?

Try this at the point you want to pause the macro:

Control will be handed back to the application, the code will continue to run once A1 is populated.

Code:
Do Until Range("A1").Value <> ""
DoEvents
Loop
 
Upvote 0

Forum statistics

Threads
1,214,544
Messages
6,120,126
Members
448,947
Latest member
test111

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