Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default EXIT SUB UPON VBCANCEL

I have the following code but upon clicking the cancel button it is resulting
in Run-time error '424' Object required.

Any suggestions?

Set SRC = Application.InputBox(PROMPT:="Select The First Cell of The
Source Data." & vbNewLine & vbNewLine, Type:=8)
If vbCancel Then
Exit Sub
End If

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default EXIT SUB UPON VBCANCEL

On Error Resume Next
Set SRC = Application.InputBox(PROMPT:="Select The First Cell of The
Source Data." & vbNewLine & vbNewLine, Type:=8)
If Err.Number < 0 Then Exit Sub
On Error GoTo 0

HTH
Daniel


I have the following code but upon clicking the cancel button it is resulting
in Run-time error '424' Object required.

Any suggestions?

Set SRC = Application.InputBox(PROMPT:="Select The First Cell of The
Source Data." & vbNewLine & vbNewLine, Type:=8)
If vbCancel Then
Exit Sub
End If



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default EXIT SUB UPON VBCANCEL

Dim Src as range
set src = nothing
on error resume next
set src = application.inputbox(....)
on error goto 0

if src is nothing then
'user hit cancel
exit sub '????
end if

....



FARAZ QURESHI wrote:

I have the following code but upon clicking the cancel button it is resulting
in Run-time error '424' Object required.

Any suggestions?

Set SRC = Application.InputBox(PROMPT:="Select The First Cell of The
Source Data." & vbNewLine & vbNewLine, Type:=8)
If vbCancel Then
Exit Sub
End If


--

Dave Peterson
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
Exit a Procedure from a Sub within a sub [email protected] Excel Discussion (Misc queries) 5 June 25th 08 06:59 PM
Exit Sub Jeff Excel Discussion (Misc queries) 2 March 1st 08 06:21 PM
Excel 07 won't exit Elle Setting up and Configuration of Excel 0 July 27th 07 12:40 AM
Run when exit PH NEWS Excel Worksheet Functions 1 July 18th 06 03:53 PM
on exit macro ditchy Excel Discussion (Misc queries) 2 May 3rd 05 12:11 AM


All times are GMT +1. The time now is 02:31 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"