Saturday, February 21, 2009

Excel VBA: The InputBox Function

In Microsoft Excel VBA Macro, to obtain a single input from the user, we can use the InputBox function.
The InputBox function is useful for obtaining a single input from the user. Here is the InputBox function syntax:

InputBox(prompt[,title][,default])

The arguments:
  • prompt: Required. Text that is displayed in the input box.
  • title: Optional. Text that appears in the input box’s title bar.
  • default: Optional. The default value.

The following is an example of how to use the InputBox function:

Sub AskUserName
ActiveSheet.Range("A1").Value = InputBox("Your name?","Input Name")
End Sub

Related posts:
---
If you like posts in this blog, you can  to support me :)

No comments:

Post a Comment