Query about Input boxes

Hottest Fudge

New Member
Joined
Oct 17, 2014
Messages
16
Dear Excel Wizards,

I was wondering if it was possible that when you answer a input box with no answer "" and then press ok then the input box loops to ask the question again. If the user inputs nothing "", and clicks cancel or clicks the red button then the sub is exited. Or even better if the user clicks cancel it goes to previous Inputbox and if clicks red button then exits sub. In summary is it possible to code actions for when either OK, CANCEL or Red button is pressed for a VBA inputbox?


Cheers,
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I have found that the trick with vbBoolean.

Example:

Answer=InputBox(" Question?")

If VarType(Answer) = vbBoolean
Exit Sub
End If
If Answer = "" then Goto Example

Still is there anyway of differentiating between red button and cancel button?
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,539
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top