PC Review


Reply
Thread Tools Rate Thread

Ask a user to select a range in Excel

 
 
Ming Ma
Guest
Posts: n/a
 
      31st Oct 2003
Hi, All:
Can anyone tell me how to write a macro that asks a user to select a range
in excel? then I would like to use values in the selectionfor other
calculation later on.

Thanks


 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      31st Oct 2003
Ming,

Try something like the following:

Dim Rng As Range
On Error Resume Next
Set Rng = Application.InputBox(prompt:="Select a range", Type:=8)
If Rng Is Nothing Then
MsgBox "no range selected"
Else
MsgBox "You selected: " & Rng.Address
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (E-Mail Removed)



"Ming Ma" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, All:
> Can anyone tell me how to write a macro that asks a user to select a range
> in excel? then I would like to use values in the selectionfor other
> calculation later on.
>
> Thanks
>
>



 
Reply With Quote
 
Ming Ma
Guest
Posts: n/a
 
      31st Oct 2003
Chip,
Thank you very much. That is exactly what I want.


"Chip Pearson" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Ming,
>
> Try something like the following:
>
> Dim Rng As Range
> On Error Resume Next
> Set Rng = Application.InputBox(prompt:="Select a range", Type:=8)
> If Rng Is Nothing Then
> MsgBox "no range selected"
> Else
> MsgBox "You selected: " & Rng.Address
> End If
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com (E-Mail Removed)
>
>
>
> "Ming Ma" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi, All:
> > Can anyone tell me how to write a macro that asks a user to select a

range
> > in excel? then I would like to use values in the selectionfor other
> > calculation later on.
> >
> > Thanks
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User to select a range for deletion jimbo Microsoft Excel Programming 3 1st Jan 2010 12:59 PM
Prompt user to select a range Aaron Dyck Microsoft Excel Programming 1 31st Oct 2008 02:06 AM
allow user to select range in Excel worksheet from Access form yax131@gmail.com Microsoft Access External Data 4 7th Aug 2008 11:06 PM
Let the user select a range from a window Torben Laursen Microsoft Excel Programming 0 13th Aug 2007 09:09 PM
Input Box that allows user to select range joecrabtree Microsoft Excel Programming 5 8th Dec 2006 04:48 PM


Features
 

Advertising
 

Newsgroups
 


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