View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Cancel Input Box error

Thanks for the nudge, Claus.

Got it to work using this.

Regards,
Howard


sNum = InputBox("Pick no more than " & vbCr & _
" " & rngFnd.Offset(, 6) & " Stocks" & vbCr & "for
Código I: " & myFnd & _ " Quantidade Retirada in Cell F10")

If sNum = "" Then
[F6,F8,F10,J10].ClearContents
Exit Sub
ElseIf sNum = False Then
[F6,F8,F10,J10].ClearContents
'MsgBox "You canceled"
Exit Sub
End If


This is still using VB's InputBox and so the 'EldeIf' will raise an
"Invalid procedure call or argument" error! Otherwise, 'If sNum = ""'
means user cancelled the InputBox. This would be the case even if text
was entered but the OK button not clicked!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion