Asking for a group of cells

  • Thread starter Thread starter Max_Venezia
  • Start date Start date
M

Max_Venezia

I'm looking for an instruction to be used into a macro which gives the
possibility to interrupt the macro until you select a group of cells
with the mouse. Then the macro has to perform some operations on the
selected cells.
I tried with InputBox but it does not permit to select a range of
cells with the mouse, you can only write it with the keyboard, for
example: "a1:a10".
Could you suggest me something about this problem? I would like some
windows like the ones you use when you select data for a graphic.
Thank you.
 
use Application.Inputbox
with the Type parameter set to 8 , range.
read help on this, its reasonable good

Patrick Molloy
Microsoft Excel MVP
 
Max,

You need Application.Inputbox. If you use this with a type of 8 you can
select a range of cells, and the address of these cells is returned to
Inputbox.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Max,

Try something like the following code:

Dim SelectedRange As Range
On Error Resume Next
Set SelectedRange = Application.InputBox( _
prompt:="Select A Range", Type:=8)
If SelectedRange Is Nothing Then
MsgBox "You clicked cancel"
Else
MsgBox "You selected: " & SelectedRange.Address
End If
On Error GoTo 0


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top