Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default application.inputbox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default application.inputbox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default application.inputbox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default application.inputbox

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default application.inputbox

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inputbox with VBA Jeff Excel Discussion (Misc queries) 3 January 19th 06 05:18 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM
Application.Inputbox Question ndp Excel Programming 3 December 8th 03 06:12 PM
inputbox help lothario[_60_] Excel Programming 4 December 7th 03 12:26 AM


All times are GMT +1. The time now is 09:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"