View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
dan dungan dan dungan is offline
external usenet poster
 
Posts: 411
Default How can I select a range manually with the mouse?

Hi Pascal,

I don't know what I'm doing that causes the procedure not to return
the Select_Cncled error message.

I copied the procedure to the sheet3 module and I run the macro from
the tools/macro menu.

When I click on the Cancel button the procedure returns the Visual
Basic Debug message box showing run time error '424'.

Here's what is in the module:
Sub Test2()


Dim MyRangeRef As Range
On Error GoTo Select_Cncled

Set MyRangeRef = Application.InputBox("Select the range of cells",
"Reference?", , , , , , 8)
MsgBox MyRangeRef.Cells.Count
'do other stuff
'etc.
Exit Sub

Select_Cncled:
MsgBox "you cancelled the previous message, you naughty!"
End Sub


The error handler is valid (and functional) if you choose the Cancel button
with the sample code supplied.

HTH
Cordially
Pascal