ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inputbox (error if close) (https://www.excelbanter.com/excel-programming/366994-inputbox-error-if-close.html)

CatherineN[_6_]

inputbox (error if close)
 

I am trying to put an input box in that wont let you just push cancel,
somethign MUST be input. Right now when they push cancle it just has
an error in the program, but this needs to be a little more user
friendly. Can i do this by having a message box pop up saying you must
enter something then close that and have the inputbox still be up, or
have a new input box come up that says you must enter a value and have
it loop until a value is input. I have no idea how to do this though,
please help.


--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=560737


Die_Another_Day

inputbox (error if close)
 
Do
str1 = Application.InputBox("Testing","Blah Blah")
While str1 = False

HTH

Die_Another_Day
"CatherineN" wrote
in message ...

I am trying to put an input box in that wont let you just push cancel,
somethign MUST be input. Right now when they push cancle it just has
an error in the program, but this needs to be a little more user
friendly. Can i do this by having a message box pop up saying you must
enter something then close that and have the inputbox still be up, or
have a new input box come up that says you must enter a value and have
it loop until a value is input. I have no idea how to do this though,
please help.


--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile:
http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=560737




colofnature[_87_]

inputbox (error if close)
 

"Do...While" isn't VBA. Use:

do while str1 = false
str1 = Application.InputBox("Testing", "Blah Blah")
loop


Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=560737


Jim Jackson

inputbox (error if close)
 
If msgbox("Your Text") = VbCancel then
msgbox("You must enter some data"),VbOkOnly
else
end if
--
Best wishes,

Jim


"CatherineN" wrote:


I am trying to put an input box in that wont let you just push cancel,
somethign MUST be input. Right now when they push cancle it just has
an error in the program, but this needs to be a little more user
friendly. Can i do this by having a message box pop up saying you must
enter something then close that and have the inputbox still be up, or
have a new input box come up that says you must enter a value and have
it loop until a value is input. I have no idea how to do this though,
please help.


--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=560737



CatherineN[_7_]

inputbox (error if close)
 

Thank you I got it to work, the logic makes sense, like any other
programming language, but the syntax really still confuses me, so
thanks for the help


--
CatherineN
------------------------------------------------------------------------
CatherineN's Profile: http://www.excelforum.com/member.php...o&userid=35469
View this thread: http://www.excelforum.com/showthread...hreadid=560737


Die_Another_Day

inputbox (error if close)
 
Sry... I just winged it without testing the code. The proper syntax is:
Do
str1 = Application.InputBox("Testing","Blah Blah")
Loop While str1 = False

Die_Another_Day
"colofnature"
wrote in message
...

"Do...While" isn't VBA. Use:

do while str1 = false
str1 = Application.InputBox("Testing", "Blah Blah")
loop


Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile:
http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=560737





All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com