View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Getting 0 to not equal False

I think you're mistaken.

I bet that the user hit entering the 0, but hitting the cancel button.

And I think I'd change that "End" statement to "exit sub"

End statements can cause trouble that may be difficult to debug later.

mkerstei wrote:

Hi,
I have a macro that is supposed to prompt for some data. If the user
hits cancel, I would like the macro to end. However, if the user
inputs 0 (the default), I need the macro to continue running.
Unfortunately, right now the macro is ending if you hit cancel, or
input 0 and hit OK. Any suggestions would be much appreciated.
Thanks.

My code:
Dim Depreciation
Depreciation = Application.InputBox(prompt:="Depreciation?",
Default:=Range("p5"), Type:=1)
If Depreciation = False Then
End
Else
Range("P5").Select
ActiveCell.FormulaR1C1 = _
Depreciation
End If

--
mkerstei
------------------------------------------------------------------------
mkerstei's Profile: http://www.excelforum.com/member.php...o&userid=25688
View this thread: http://www.excelforum.com/showthread...hreadid=557455


--

Dave Peterson