MrExcel Publishing
Your One Stop for Excel Tips & Solutions

input boxes


Posted by Vicky on April 18, 2001 6:30 AM

Hello, I'm an excel student that unfortunately hasn't quite grasped visual basic!

As part of my assignment I have the following code repeated throughout my work:

-----------------------------------------------------

Range("B8") = InputBox(prompt:="Please enter the Part No.")
empty_Check = IsEmpty(Range("B8"))
Do Until empty_Check = False
MsgBox ("You have not entered data"), 0
Range("B8") = InputBox(prompt:="Please enter the Part No.")
empty_Check = IsEmpty(Range("B8"))
Loop

-----------------------------------------------------

Unfortunately, no matter how I change my code I cannot get the "cancel" function to work on the input box. Whenever I try to change the code, my message boxes don't work correctly.

Please could someone help? Thankyou.


Posted by gregc on April 18, 2001 11:47 AM


After your message box line put an if statement in as follows

if empty_Check = False then
exit sub
end if

Posted by Vicky on April 19, 2001 6:27 AM

ThankYou

It's amazing how the simplest of things can do so much!!!
Thanks Again.