Lesson#73: Take input by input box and show it in the message box
This post will make you learn how to show an input box in VBA. Take input by input box and show it in the message box.
1. Go to Developer Tab.
2. Click on Insert.
3. Select Button (Form Control).
3. Select Button (Form Control).
4. Put the button on the worksheet by dragging and putting it on the sheet.
5. Immediately Macro name window will appear.
6. Click on New.
6. Click on New.
7. There you have to put this Code.
Sub Button2_Click()
Dim Name As String
Name = InputBox(“What is your Name?”)
MsgBox (“Hello “) + Name
End Sub
Dim Name As String
Name = InputBox(“What is your Name?”)
MsgBox (“Hello “) + Name
End Sub
8. Click on Run Sub/ UserForm.
Now you can Input any string into the input box and show it in a message box after “Hello ”
Leave a Reply