View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
FARAZ QURESHI FARAZ QURESHI is offline
external usenet poster
 
Posts: 553
Default Meaning of On Error Goto 0

Thanx Jacob,

However, such a code is not correctly working for the Type:=8 inputbox.
Modifying the code to:

Sub test2()
Dim varInput As Variant
varInput = Application.InputBox("Please enter the value", Type:=8)
If varInput = False Then
MsgBox "You cancelled the operation"
Else
MsgBox (varInput.Address)
End If
End Sub

is showing MsgBox "You cancelled the operation" even though I selected a
range, instead of showing the address of the cells.

"Jacob Skaria" wrote:

To notify cancel please try the below

Dim varInput As Variant
varInput = Application.InputBox("Please enter the value")
If varInput = False Then MsgBox "You cancelled the operation"

On error handling please refer the below link
http://msdn.microsoft.com/en-us/libr...as(VS.80).aspx



If this post helps click Yes
---------------
Jacob Skaria


"FARAZ QURESHI" wrote:

Would one of you please explain the following code to me step by step?

Sub test()
Dim x As Range
On Error Resume Next
Set x = Application.InputBox("Select the cells.", Type:=8)
If Err.Number < 0 Then
MsgBox ("You Cancelled The Operation.")
Exit Sub
On Error GoTo 0
End If
MsgBox (x.Address)
End Sub

All I want to do is create an inputbox which ONLY upon hitting the Cancel
Button would display the msgbox "You Cancelled The Operation." and not on any
other error.

All your help and expert advice shall be obliged.

Thanx in advance.