View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Application.InputBox

Dim EnterAmount As Variant

EnterAmount = Application.InputBox(Prompt:="Enter the amount to Hardcode:", _
Type:=1)

If EnterAmount = False Then
'what should happen?
Else
'do the real work
activecell.value = enteramount
end if

Steven wrote:

I have the following code:

vAmount = ActiveCell.Value
Dim EnterAmount As Variant
EnterAmount = InputBox("Enter the amount to Hardcode: ", , vAmount)
If EnterAmount < "" Then
ActiveCell.Value = EnterAmount
End If

Now if I hit cancel the amount will remain what it was.

But if I use Application.InputBox:
EnterAmount = Application.InputBox("Enter the amount to Hardcode: ", ,
vAmount, , , , , Type:=1)
then if I hit Cancel I will get a False in the cell. How do I make it so
if I hit Cancel with using the Application.Input box the cell will not change
to False but will remain what the cell was when I entered the cell like the
InputBox does.

Thank you for your help,

Steven


--

Dave Peterson