Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Input Boxes in VBA Excel (InputBox)

Input Box in VBA Excel is a fea­ture where user can pro­vide input dur­ing the run­time of a pro­gram. The pro­vided input may or may not be val­i­dated fur­ther in code.

  • Open a new Excel Work­Book and press “Alt+F11” to open the Visual Basic Editor
  • Copy Paste the fol­low­ing 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
Input Box in Excel Macro-1

Input Box in Excel Macro-1

  • Enter ‘12’ in Input­Box and hit ‘OK
Input Box in Excel Macro -2

Input Box in Excel Macro –2

Click here to read about ‘Msg­box in Excel Macro’

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: