View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Francis Hookham Francis Hookham is offline
external usenet poster
 
Posts: 125
Default End Sub if InputBox cancelled (False)

Many thanks George and Cory - all's well now

I was trying to use False because I read in VBA Help - InputBox Remarks:

If you choose the OK button, InputBox returns the value entered in the
dialog box. If you click the Cancel button, InputBox returns False.

Francis Hookham


"George Nicholson" wrote in message
...
Input Boxes return strings, not T/F. A Cancelled Input box returns an
empty string: ""

Select Case x
Case ""
' User Canceled
Exit Sub
Case DoorNum
' x hasn't changed: do nothing
Case Else
' x has changed
DoorNum = x
End select


"Francis Hookham" wrote in message
...
Input Box Cancel button should stop the subroutine.



OK button tests to see if 'x' has been changed.



I cannot see what is wrong he



LastUsedRow = Sheets("Pages").Cells(Rows.Count, 5).End(xlUp).Row

DoorNum = Cells(LastUsedRow, 5)

x = InputBox("Door number?", _

"Additional items to door", DoorNum, 1)

If x = False Then

End

ElseIf x < DoorNum Then

DoorNum = x

End If



Francis Hookham