View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default msgbox weird behaviour

I agree with Dave, the code behaves as it should including the use of the
Numeric Keypad Enter key. The code is not the problem and on a normal
keyboard there should be no problem using either of the enter keys.

"JLR-Mart" wrote:

The code is below, although the issue isn't with the user input it's about
different behaviour depending on whether the user submits his answer using
the okay button, the return key or enter key!

On Error Resume Next
RCHOSEN = Application.InputBox("Please enter the row number of the new
part's parent and then choose OK", title:="Please identify the parent of the
new part", Type:=1)
On Error GoTo 0

"Bernie Deitrick" wrote:

Try limiting what the user can enter: Type:=1 means a number:

Sub TryNow()
Dim myT As Double
myT = Application.InputBox("Enter a number...", Type:=1)
MsgBox myT
End Sub

HTH,
Bernie
MS Excel MVP


"JLR-Mart" wrote in message
...
I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???