LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default inputbox error when clicking cancel

Sub SelectRange()
Dim UserRange As Range
On Error Resume Next
Set UserRange = Application.InputBox( _
prompt:="Please input or select a range", Type:=8)
If UserRange is Nothing then Exit Sub
UserRange.Font.Bold = True
On error Goto 0
End Sub

Charles Chickering
ADK wrote:
If someone uses this code, but clicks cancle on the inputbox you get a code
error. What cacode can be added to prevent this error?

Sub SelectRange()
Dim UserRange As Range
Set UserRange = Application.InputBox( _
prompt:="Please input or select a range", Type:=8)
UserRange.Font.Bold = True
End Sub




 
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
Cancel on INPUTBOX macro causes error Barb Reinhardt Excel Programming 7 January 21st 06 11:28 PM
InputBox Function & Cancel Otto Moehrbach[_6_] Excel Programming 4 September 30th 04 01:13 AM
Help with inputbox (Distinguish OK from Cancel) NooK[_47_] Excel Programming 3 August 5th 04 11:45 AM
Clicking Cancel on an Inputbox rott[_6_] Excel Programming 3 March 5th 04 02:57 AM
Inputbox and cancel button Uddinj1 Excel Programming 5 March 2nd 04 11:27 AM


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