Link to home
Start Free TrialLog in
Avatar of ronadair
ronadair

asked on

Pause macro for data entry & prompt user with a message to enter the data...

I wrote a series of individual macros in excel that I want to operate sequentially.  I'm ready to compile them into one grand macro, but I need the grand macro to pause while the user enters data into the spreadsheet.  Once the data is entered, I'd like the macro to run through to completion.

Suggestions?
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Attached is an example workbook.

Kevin
Q-23828249.xls
If you have no need for creaing an extra foorm you may use InputBox function. Below is the sample from MS VBA Help
"Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a String containing the contents of the text box... If the user clicks OK or presses ENTER , the InputBox function returns whatever is in the text box. If the user clicks Cancel, the function returns a zero-length string ("")."  

Dim Message, Title, Default, MyValue
Message = "Enter a value between 1 and 3"    ' Set prompt.
Title = "InputBox Demo"    ' Set title.
Default = "1"    ' Set default.
' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)
 
' Use Helpfile and context. The Help button is added automatically.
MyValue = InputBox(Message, Title, , , , "DEMO.HLP", 10)
 
' Display dialog box at position 100, 100.
MyValue = InputBox(Message, Title, Default, 100, 100)

Open in new window

Avatar of ronadair
ronadair

ASKER

Thanks... the procedure works.  One more question:  what code should I enter to exit the sequence so I can start from the beginning in case the data is in some way not ready to enter?
hippohood,

That does not solve the problem. VB and Excel message and input boxes are displayed modally which prevents the user from interacting with the worksheet. The Asker specifically stated that he wants the user to interact with the worksheet while the dialog is displayed.

Kevin