Vba input box in Excel
The InputBox is used to get dynamic input from the user.
The "Dynamic" refers to the fact that the user can assign value to a variable at the runtime.
This is most useful and simple to use.
The Inputbox has other parameters such as Xposition,Yposition and so on but are not widely used.
The following example illustrates Input box functionality.
- Sub InpuBox()
- Dim i As Integer
- i = InputBox("Enter a number", "Input Box Demo")
- MsgBox I + 1
- End Sub
The screenshot of the script is shown below:
The Output is as shown below.
When a number is entered in the Inputbox and Ok clicked, a message box is isplayed with the output