View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Cancel button in Inputbox method


Mira,

no, you'll have to prevent the error when the inputbox is cancelled.


Sub inputtest()
Dim rngVariable As Range
On Error Resume Next
Set rngVariable = Application.InputBox(prompt:="Range?", Type:=8)
On Error GoTo 0

If rngVariable Is Nothing Then
'user cancelled
Else
MsgBox rngVariable.Address
End If

End Sub

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"MiRa" wrote:

Hi everybody,
when I use Inputbox method with Type : = 8 (Set MyObject = Input....)
and I click on Cancel button, I will get an error.
Is there any way to avoid this without On Error Goto Label ?

Thanks for answer.

MiRa