ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inputbox (https://www.excelbanter.com/excel-programming/278913-inputbox.html)

Lawson

inputbox
 
who do i get the sub to not continue if the cancel button
is hit?

Do 'loop until proper number
entered
Check = True

If Range("d15") = "" Then
MyValue1 = InputBox(Message1, Title1, Default)
Range("m45") = MyValue1
End If

If MyValue1 = vbCancel Then ???? 'want it to end here :)

If Not (MyValue1 = 0 And MyValue1 < 50) Then
MyValue1 = 7
Range("m45") = MyValue1
MyValue3 = MsgBox("Enter value between 0 and 50",
vbOKOnly, "Invalid Number Entered")
Else
Check = False
If Range("d15") = "" Then MyValue2 = MsgBox(Message2,
Style, Title2)
End If

Loop Until Check = False

Dan E[_2_]

inputbox
 
Lawson,

Try:

If MyValue1 = "" Then Exit Sub

vbCancel won't work

Dan E

"Lawson" wrote in message ...
who do i get the sub to not continue if the cancel button
is hit?

Do 'loop until proper number
entered
Check = True

If Range("d15") = "" Then
MyValue1 = InputBox(Message1, Title1, Default)
Range("m45") = MyValue1
End If

If MyValue1 = vbCancel Then ???? 'want it to end here :)

If Not (MyValue1 = 0 And MyValue1 < 50) Then
MyValue1 = 7
Range("m45") = MyValue1
MyValue3 = MsgBox("Enter value between 0 and 50",
vbOKOnly, "Invalid Number Entered")
Else
Check = False
If Range("d15") = "" Then MyValue2 = MsgBox(Message2,
Style, Title2)
End If

Loop Until Check = False




Lawson

inputbox
 
Thanks Dan...worked perfectly :)

-----Original Message-----
Lawson,

Try:

If MyValue1 = "" Then Exit Sub

vbCancel won't work

Dan E

"Lawson" wrote in message

...
who do i get the sub to not continue if the cancel

button
is hit?

Do 'loop until proper number
entered
Check = True

If Range("d15") = "" Then
MyValue1 = InputBox(Message1, Title1, Default)
Range("m45") = MyValue1
End If

If MyValue1 = vbCancel Then ???? 'want it to end

here :)

If Not (MyValue1 = 0 And MyValue1 < 50) Then
MyValue1 = 7
Range("m45") = MyValue1
MyValue3 = MsgBox("Enter value between 0 and 50",
vbOKOnly, "Invalid Number Entered")
Else
Check = False
If Range("d15") = "" Then MyValue2 = MsgBox(Message2,
Style, Title2)
End If

Loop Until Check = False



.



All times are GMT +1. The time now is 10:26 AM.

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