Be the first user to complete this post
|
Add to List |
Input Boxes in VBA Excel (InputBox)
Input Box in VBA Excel is a feature where user can provide input during the runtime of a program. The provided input may or may not be validated further in code.
- Open a new Excel WorkBook and press “Alt+F11” to open the Visual Basic Editor
- Copy Paste the following code
Sub FnSomeValues intInput = InputBox("Enter the Number") If (intInput Mod 2) = 0 Then MsgBox "Even Number" Else MsgBox "Odd Number" End If End Sub
- Run the Macro
- Enter '12' in InputBox and hit 'OK'
Click here to read about 'Msgbox in Excel Macro'