Tuesday, March 15, 2016

How to manage the Cancel response from an inputbox in EXCEL VBA

To exit the inputbox form when a user press the cancel button, simply write exit sub when the result of the inputbox function is nothing:

Sub create_array()
pp = InputBox("How are you today?")
If pp = "" Then Exit Sub
msgbox("Your answer is " & pp)
End Sub



Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 89 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

No comments:

Post a Comment