Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 11
Default How can I select a range manually with the mouse?

I like a macro which gives me control to select a range in a worksheet
manually, then continues with the macro.

I'd hoped to have a message box with something like "Select the range
to process" which I select off the worksheet with my mouse and then I
click ok to continue. I've googled and can'd find any pointers.

Can anyone help please?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default How can I select a range manually with the mouse?

Hello Ian

Use Application.Inputbox:

Dim MyRangeRef As Range
On Error GoTo Select_Cncled
Set MyRangeRef = Application.InputBox("Select the range of cells",
"Reference?", , , , , , 8)
Exit Sub

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

HTH
Cordially
Pascal

"ian" a écrit dans le message de news:
...
I like a macro which gives me control to select a range in a worksheet
manually, then continues with the macro.

I'd hoped to have a message box with something like "Select the range
to process" which I select off the worksheet with my mouse and then I
click ok to continue. I've googled and can'd find any pointers.

Can anyone help please?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default How can I select a range manually with the mouse?

Even if it seems obvious, let me just indicate that you will then be able to
use the range for further actions before the "Exit Sub", eg:

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!"

HTH
Cordially
Pascal

"papou" a écrit dans le message
de news: ...
Hello Ian

Use Application.Inputbox:

Dim MyRangeRef As Range
On Error GoTo Select_Cncled
Set MyRangeRef = Application.InputBox("Select the range of cells",
"Reference?", , , , , , 8)
Exit Sub

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

HTH
Cordially
Pascal

"ian" a écrit dans le message de news:
...
I like a macro which gives me control to select a range in a worksheet
manually, then continues with the macro.

I'd hoped to have a message box with something like "Select the range
to process" which I select off the worksheet with my mouse and then I
click ok to continue. I've googled and can'd find any pointers.

Can anyone help please?

Thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 11
Default How can I select a range manually with the mouse?

Pascal

Thanks. Never used an Application.Inputbox before. Always easy when
you know how.

I'm not often Naughty,

Ian

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default How can I select a range manually with the mouse?

Hi,

The error handling didn't work for me using excel 2000 on xp.
If I didn't select a range and clicked ok, the procedure returned the
Dialog box-- The formula you typed contains an error.


On Oct 25, 3:24 pm, ian wrote:
Pascal

Thanks. Never used an Application.Inputbox before. Always easy when
you know how.

I'm not often Naughty,

Ian





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default How can I select a range manually with the mouse?

Sorry I sent the last message before I was finished typing.

Anyway, If I choose the cancel button, the procedure returns runtime
error 424--object required.

Also, I could never get the procedure to go to the error handler.

Please help me understand the error handling.

Thanks,

Dan

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
How do I select a range of cells in an Excel table using the mouse jlethco_texas Excel Discussion (Misc queries) 1 April 12th 10 11:23 PM
Not able to select range of cells with mouse. jen New Users to Excel 2 September 16th 09 06:21 PM
Cannot select single cell. Mouse move automatically creates range. Dave Jones - England Excel Discussion (Misc queries) 1 April 22nd 07 09:37 AM
Code to Select a Combobox with having to Manually Mouse or Tab to enter a value Coza Excel Programming 2 March 20th 07 08:21 AM
Mouse sticks in select range mode NaughtyMouse Excel Discussion (Misc queries) 8 November 6th 05 01:35 AM


All times are GMT +1. The time now is 08:57 AM.

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

About Us

"It's about Microsoft Excel"