View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Danny Danny is offline
external usenet poster
 
Posts: 148
Default Input Box - CANCEL

Gord,

Your macro is the one I used. I tried some variables so I can use formula in
the input box and came up with:

If selectnum = "" Then Exit Sub

Thank you all!

"Gord Dibben" wrote:

Danny

I would tend to check for nothing entered or wrong data type entered.

Sub InputNumber()
selectnum = InputBox("What is the number?")
If selectnum = "" Or Not IsNumeric(selectnum) Then Exit Sub
Range("A1").Value = selectnum
End Sub


Gord Dibben MS Excel MVP

On Mon, 27 Nov 2006 15:32:02 -0800, Danny
wrote:

Hi,

Please edit the macro below so when the user clicks on CANCEL or CLOSE the
box, Range A1 existing input won't change.

Sub InputNumber()
Range("A1").Value = InputBox("What is the number?")
End Sub

Thank you.