Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default InputBox Cancel event

I have the following code prompting the user to select a range.

Set rng = Application.InputBox(Msg1, Title1, Type:=8)

I need to be able to trap both a CANCEL event as well as when the user
clicks "OK" without selecting a range.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default InputBox Cancel event


Try something like

Dim R As Range
On Error Resume Next
Set R = Application.InputBox(prompt:="Enter", Type:=8)
If R Is Nothing Then
Debug.Print "cancelled"
Else
Debug.Print "selected: " & R.Address
End If

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Mon, 9 Feb 2009 07:12:01 -0800, Rafi
wrote:

I have the following code prompting the user to select a range.

Set rng = Application.InputBox(Msg1, Title1, Type:=8)

I need to be able to trap both a CANCEL event as well as when the user
clicks "OK" without selecting a range.

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 Cancel Button A Mad Doberman Excel Programming 1 June 20th 08 09:49 PM
Test for Cancel in Inputbox Fred Smith Excel Programming 5 April 6th 07 03:36 AM
How do I capture CANCEL on an Inputbox? Toxicdistortion Excel Programming 0 October 27th 06 12:37 AM
InputBox Function & Cancel Otto Moehrbach[_6_] Excel Programming 4 September 30th 04 01:13 AM
Inputbox and cancel button Uddinj1 Excel Programming 5 March 2nd 04 11:27 AM


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