Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Using InputBox to Get Data.

Using InputBox to Get Data

by Allen Wyatt
(last updated August 23, 2016)


If you are developing a simple custom application in Excel, you may want to use the InputBox function to retrieve information from the user, and then place that information in a particular place in a worksheet. This can be easily done in the following manner:

UserValue = InputBox("Value to use?")
Cells(1, 1).Value = UserValue

These two lines, when inserted into a macro, prompt the user for input. This input is assigned to the UserValue variable by the InputBox function. The contents of this variable are then deposited in cell A1 of the current worksheet using the Cells method. If you prefer, you could also use the Range object to specify a location for the value, as shown here:

UserValue = InputBox("Value to use?")
Range("B3").Value = UserValue

This example deposits the value of UserValue into cell B3.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12496) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Using InputBox to Get Data.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Rejecting Changes in a Document

When a group of people edits a document with Track Changes turned on, it can be tempting for one of the editors to use the ...

Discover More

Coloring Cells with Formulas

Easily seeing where all the formulas are in your worksheet can be handy. Here are some ideas on different ways you can color ...

Discover More

Centering Your Worksheet

Got just a small amount of worksheet data to print out? It might look better on the printed page if you center it. Excel ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Understanding Macros

What is a macro? Ever wonder what these are and how to use them? This tip answers the basics of what a macro is used for, ...

Discover More

Finding the Last-Used Cell in a Macro

Ever wonder what the macro-oriented equivalent of pressing Ctrl+End is? Here's the code and some caveats on using it.

Discover More

Running a Macro in a Number of Workbooks

Got a macro that you need to run on each of a number of workbooks? Excel provides a number of ways to go about this task, as ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 4?

2016-08-24 10:22:39

Gary Lundblad

Thanks Tom! I can kind of see what you mean, and I'm intrigued by the idea. I'll try to work on this angle.

Thank you again!


2016-08-23 21:14:18



You may not need to use VBA at all.
You may be able to do everything using data validation and some clever formulas.

Search the web for using named ranges and the INDIRECT function in data validation. You can design the possible range of answers for each question.
When as user responds, the next question can then be chosen based on their response.
If you hide the supporting sheets, lock all cells except the input ones, and protect the sheet and the workbook, it can be made almost idiot and tamper proof.

2016-08-23 20:09:52

Gary Lundblad

Thank you Dave- I'll check that out!


2016-08-23 18:02:28

Dave Unger

Gary, probably what you'd want to do is build a "wizard", using a MultiPage UserForm. John Walkenbach has examples of how to go about it in his books, and there are quite a few links available on the Internet - Google "vba multipage wizard"

2016-08-23 10:36:25

Gary Lundblad

I would like a macro to step someone through a series of questions, where their answers dictate the next questions asked. The answers will all be true or false, and will ultimately describe a scenario that will provide direction and then ask for appropriate information, i.e. names, amounts, address, date, etc.. As a result of the answers, only 5 at the most, and the subsequent information provided, forms would be filled out properly. Is this type of thing difficult to do in Excel using a macro. I basically want to idiot-proof the process and ensure that all pertinent information is completed, and the appropriate scenario is described. I have the series of questions and subsequent answers, but am wondering how difficult it would be to write the VBA to automate it.

Thank you!


2015-03-11 23:23:52

D P Jindal

I want to get input and want to use it in a report: where field value is the input so that the report display for a particular row(record)

2013-04-29 08:33:32


Could be important to note here that if the ONLY thing you are using the input box for is to add a value to a cell then you don't need to bother with the intermediary variable:

Cells(1,1).Value = InputBox("Value to use?")

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.