Dave showed you the code. The explanation is that for InputBox function,
cancel equals "". For InputBox Method, cancel equals "False". So if you use
Application.InputBut you have to change your "If" statement to match whatever
cancel equals.
"Dave Peterson" wrote:
> 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
>
|