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.


InputBox (,)</p> <p>The Inputbox has other parameters such as Xposition,Yposition and so on but are not widely used.</p> <p>The following example illustrates Input box functionality.</p> <div class="code_long1"><ol> <li>Sub InpuBox()</li> <li>Dim i As Integer</li> <li>i = InputBox("Enter a number", "Input Box Demo")</li> <li>MsgBox I + 1</li> <li>End Sub</li> </ol></div> <p>The screenshot of the script is shown below:</p> <p><img alt="excel vba input box" longdesc="excel vba input box" src="images/faq_images/vba-input-box-1.png"></p> <p><img alt="excel vba input box" longdesc="excel vba input box" src="images/faq_images/vba-input-box-2.png"></p> <p>The Output is as shown below.</p> <p>When a number is entered in the Inputbox and Ok clicked, a message box is isplayed with the output </p> <p><img alt="excel vba input box" longdesc="excel vba input box" src="images/faq_images/vba-input-box-3.png"></p> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- google 2017 responsive FAQ --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3347919734750295" data-ad-slot="9940108129" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <p class="meta"> </p> <p class="meta"> </p> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- google 2017 responsive FAQ --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3347919734750295" data-ad-slot="9940108129" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- responsive_link_units_FAQ --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3347919734750295" data-ad-slot="7654879658" data-ad-format="link"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><p class="meta"> </p> <h4> You can find similar Excel Questions and Answer hereunder </h4> <p class="meta">1) <a href="excel-faq-how-to-change-desktop-background.php">How to change desktop background in Excel</a></p> <p class="meta">2) <a href="excel-vba-how-to-use-find.php">How do I use Find to determine last occurrence of a string in a WorkSheet range using VBA?</a></p> <p class="meta">3) <a href="excel-get-percentile-rank-for-students.php">I conducted a test and the test scores are available - how can I get Percentile rank of students?</a></p> <p class="meta">4) <a href="excel-vba-input-box-and-display-in-cell.php">How can I get input from user through a prompt and assign user's input to a cell?</a></p> <p class="meta">5) <a href="excel-avoid-gap-in-chart.php">How can I avoid a gap in a line chart for missing data?</a></p> <p class="meta">6) <a href="excel-add-prefix-to-numbers-in-range.php">How can I add a Prefix to a set of numbers in a range?</a></p> <p class="meta">7) <a href="excel-vba-message-box-in-vba.php">How to display messages boxes in VBA with the msgbox function</a></p> <p class="meta">8) <a href="excel-vba-list-box-control.php">Here an explanation about list box and how to control list boxes in Excel VBA</a></p> <p class="meta">9) <a href="excel-concatenate-with-line-break.php">I want a formula to concatenate multiple cell values separated by a line break.</a></p> <p class="meta">10) <a href="excel-debugging-worksheet-find-inheritance-parent-of-cell.php">How can I identify the cells that influence a particular cell to help with debugging of my spreadSheet or understand a spreadSheet that I inherited?</a></p> <p class="meta"> </p> </article><!--blog post--> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- google 2017 responsive FAQ --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3347919734750295" data-ad-slot="9940108129" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <h4> Here the previous and next chapter </h4> <nav class="pagination"> <ul> <li><a href="fulllistofexamples.php">1000 examples</a> </li> <li><a href="excel-vba-message-box-in-vba.php">Vba message box in vba </a> <li><a href="excel-vba-operators.php">Vba operators </a> </ul> </nav> <!--end pagination--> </div><!--end ten-- end the div of template1.html--> <aside class="five columns"> <div class="offset-by-one"> <div class="social"> <p><a href="links-useful-excel.php">Contact us - Links - Books</a></p> <p><a href="kiva.php">Help alleviate global poverty </a></p> </div> <table style="margin-top:12px;" border="0"> <tr> <td height="35" style="vertical-align: top;"><div id="fb-root"></div><div class="fb-like" data-layout="button" data-action="like" data-show-faces="false" data-share="true"></div></td> <td width="4"></td> <td height="35" style="vertical-align: top;"><a href="https://twitter.com/share" class="twitter-share-button" data-via="ExcelMadeEasy"></a></td> </tr> </table> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> <h4>Want To Learn More?</h4> <p><a href="excel-vba-input-box-and-display-in-cell.php">Vba input box and display in cell </a></p> <p><a href="excel-vba-textbox-control-text-box.php">Vba textbox control text box </a></p> <p><a href="excel-vba-message-box-in-vba.php">Vba message box in vba </a></p> <p><a href="excel-vba-list-box-control.php">Vba list box control </a></p> <p><a href="excel-vba-display-open-dialog-box-explorer.php">Vba display open dialog box explorer </a></p>  <h4>You might like</h4> <ul> <li><a href="excel-calculation-table-generator-school.php">Basic Calculation for Kids</a></li> <li><a href="excel-health-topics.php">Health & Diet topics</a></li> <li><a href="top_10_templates.php">Top 10 Excel Templates</a></li> <li><a href="top_10_excel_formulas_part1.php">Top 10 most used functions and formulas</a></li> <li> <a href="template_purchase_order.php">Purchase Order Template</a></li> <li><a href="template_invoice_excel.php">Invoice Template</a></li> <li><a href="project-management-in-details.php">Projects Management</a></li> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3347919734750295" crossorigin="anonymous"></script> <!-- Excel Link Unit 200x90 [previously link ad unit] --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3347919734750295" data-ad-slot="7778947562" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <li> <a href="template_travel_expense_report.php" target="_blank">Travel Expense Report</a> </li> <li> <a href="templates-nutritional-charts.php"> Nutritional Value of Food</a></li> <li><a href="business-swot-template-in-excel.php" target="_blank">SWOT Matrix template</a></li> <li><img alt="new" height="13" src="images/icons/newicon.gif" width="22"><a href="template_life_targets_goal_setting_excel.php">Track you life goals and achievements</a></li> <li><a href="example-more-than-255-series_in_excel.php">More than 255 data series per chart</a></li> <li><a href="budget.php">Budget template</a></li> <li> <a href="calendar-page-in-excel.php">Calendars</a></li> <li> <a href="featured_courses.php" target="_blank"> <img alt="" height="89" src="images/yodalearning2.jpg" width="150"><br> Featured courses </a></li> <li> <a href="business-model-in-excel.php">Create your business with our business model template</a></li> <li><a href="open-topic-list-excel.php">Task List, To Do List</a></li> <li> <a href="excel-template-job-search.php">JOB search Tracking List Template</a></li> <li><a href="excel-shortcut-full-list.php" target="_blank"> Excel Keyboard Shortcuts</a></li> <li><a href="example_calculate_pi_in_excel.php">Calculate Pi</a></li> </ul> <h4>Frequently Asked Questions</h4> <p><a id="faq" href="faq_excel_change_color_tabs.php">Can I change the color of the worksheet tabs in my workbook?</a> </p> <p><a id="faq" href="faq_recover_excel_password.php">I saved my workbook with a password and Excel won't recognize it. How can I recover my document? </a></p> <p><a id="faq" href="faq_excel_display_week_days.php">How can I display the day of the week?</a></p> <p><a id="faq" href="faq_sum_time_value_excel.php">I have a range of time values, but when I try to sum them, the total is never greater than 24 hours.</a></p> <p><a id="faq" href="faq_excel_print_one_page.php">How can I print on one page? </a></p> <p><a id="faq" href="faq_second_y_axis.php">How to add a second Y axis on my excel chart? </a></p> <p><a id="faq" href="faq-remove-hyperlinks-in-spreadsheet.php">How to remove all hyperlinks in an excel spreadsheet </a></p> </div><!--end offset--> </aside><!--end six--> </div><!--end container--> </div><!--end band--> <div class="band footer"> <footer class="container main"> <div class="fourteen columns"> <!-- maximum 4 colonnes car cela doit passer de coté --> <h3 class="logo"><a href="#">Excel Made Easy</a></h3> <p>Excel Made Easy was founded in 2002. Excel Made Easy is a service to people looking to learn Microsoft Excel or any other spreadsheet SW on the market. </p> <p>We endeavor to provide the best service and support and to respond quickly to your questions.</p> <p>Excel Made Easy is a proud sponsor of <a href="http://www.dismantle-it.com" target="_blank" rel="nofollow">Dismantle-It.com</a> the site that shows you the belly of your daily objects, <a href="http://www.poupounette.com" target="_blank" rel="nofollow"> Poupounette.com</a> the site of cars loving cat and <a href="http://www.powerpointmadeeasy.com" target="_blank" rel="nofollow">PowerPointMadeEasy.com</a> the world top reference for PowerPoint Presentations questions and <a href="http://petscemeteryonline.com/" target="_blank" rel="nofollow"> Pet Cemetery Online</a> a site dedicated to your loving Pets.</p> </div><!--end four--> <div class="two columns"> <!--fin suivi--> </div><!--end two--> </footer><!-- container --> </div><!--end band--> <div class="band bottom"> <footer class="container"> <div class="eight columns first-credit"> <p>Copyright © 2002 - 2018 <a href="http://www.excelmadeeasy.com">Excel Made Easy</a> All Rights Reserved. </p> </div><!--end eight--> <div class="eight columns last-credit"> <p>A <a href="http://www.zetit.com" rel="nofollow">Zetit</a> Website <a href="privacypolicy.php">Privacy Policy</a></p> </div><!--end eight--> </footer><!-- container --> </div><!--end band--> </div><!--end page--> <!-- JS ================================================== --> <script src="https://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="javascripts/tabs.js"></script> <!--plugins--> <!-- <script src="javascripts/jquery.tweet.js"></script> <script src="javascripts/jquery.flickrush.js"></script> <script src="javascripts/jquery.flexslider.js"></script> --> <!--instantiate js plugins--> <script src="javascripts/whatever.js"></script> <!-- End Document ================================================== --> </body> </html>