Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Input in makro

0

How do I stop a makro to wait for input ?

Answer
Discuss

Answers

0

Use a command in your macro as shown below.

Dim MyInput As Variant
MyInput = InputBox("Enter my input", "Default value", Title of InputBox"
If Len(MyInput) = 0 then Exit Sub

The macro continues running when the user presses ENTER. The last line above terminates execution however, if the user entered nothing. To do so in the above case he would have to delete the default value. But you can omit the default value argument from the InputBox syntax and present a blank field to the user in that way.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login