Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
When i run following program and press Cancel button, Error Code: 424 occurs. Dim aralik As Range Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) How can i check that the cancel button was pressed? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Murat
Dim aralik As Range On Error Resume Next Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) If Err Then MsgBox "You pressed cancel" End If HTH Regards Pascal "Murat" a écrit dans le message de ... Hi, When i run following program and press Cancel button, Error Code: 424 occurs. Dim aralik As Range Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) How can i check that the cancel button was pressed? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try Sub foo() .... Dim aralik As Range On Error Resume Next Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) If Err < 0 Then Exit Sub End If On Error GoTo 0 ' your code .... End Sub -- Regards Frank Kabel Frankfurt, Germany Murat wrote: Hi, When i run following program and press Cancel button, Error Code: 424 occurs. Dim aralik As Range Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) How can i check that the cancel button was pressed? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Murat,
The problem is being caused by the Set statement, there is nothing to set when Cancel is hit. In this sort of instance, you have to manage the situation yourself, trap the error and respond to that. To trap the error, use On Error Resume Next. Check help for details. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Murat" wrote in message ... Hi, When i run following program and press Cancel button, Error Code: 424 occurs. Dim aralik As Range Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) How can i check that the cancel button was pressed? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks all
"Murat" wrote in message ... Hi, When i run following program and press Cancel button, Error Code: 424 occurs. Dim aralik As Range Set aralik = Application.InputBox(prompt:="Select range:", Type:=8) How can i check that the cancel button was pressed? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inputbox with VBA | Excel Discussion (Misc queries) | |||
macro to close excel application other than application.quit | Excel Programming | |||
application.quit will not shut off application | Excel Programming | |||
Application.Inputbox Question | Excel Programming | |||
inputbox help | Excel Programming |