View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Cancel button in Inputbox method

MiRa,

Try something like the following:

Dim Rng As Range
On Error Resume Next
Set Rng = Application.InputBox("select", Type:=8)
On Error GoTo 0
If Rng Is Nothing Then
MsgBox "You clicked Cancel"
Else
MsgBox "You selected: " & Rng.Address
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"MiRa" wrote in message
...
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