Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to: User selected range?

My goal is to have a spreadsheet with a few thousand rows of data,
including a coloum of unique numbers. User should be able to select by
dragging a range, ad get in return, a comma deliminated list of all of
the numbers in that range. I have the second part ready. A function
which you give a range, and it returns the list.

Now, how do I get that range from the user? Ideally, the formula using
that function would use a range name, so my problem becomes how to get a
user to select a range and hit a macro button, or hit a macro button and
select a range, with the selected range being assigned that particular
name...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to: User selected range?

Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
r.Select
MsgBox (r.Address)
End Sub

This will work whether the user types the range in the box or uses the mouse.
--
Gary''s Student - gsnu200821


"Phil Smith" wrote:

My goal is to have a spreadsheet with a few thousand rows of data,
including a coloum of unique numbers. User should be able to select by
dragging a range, ad get in return, a comma deliminated list of all of
the numbers in that range. I have the second part ready. A function
which you give a range, and it returns the list.

Now, how do I get that range from the user? Ideally, the formula using
that function would use a range name, so my problem becomes how to get a
user to select a range and hit a macro button, or hit a macro button and
select a range, with the selected range being assigned that particular
name...


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to: User selected range?

Great, but how do I assign that range to MyRangeName?




Gary''s Student wrote:
Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
r.Select
MsgBox (r.Address)
End Sub

This will work whether the user types the range in the box or uses the mouse.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to: User selected range?

Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
Set MyRangeName = r
End Sub

--
Gary''s Student - gsnu200821


"Phil Smith" wrote:

Great, but how do I assign that range to MyRangeName?




Gary''s Student wrote:
Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
r.Select
MsgBox (r.Address)
End Sub

This will work whether the user types the range in the box or uses the mouse.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to: User selected range?

Nope. It runs with no errors, but the cells covered by that range do
not change to the selected cells. The range remains the same...


Gary''s Student wrote:
Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
Set MyRangeName = r
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to: User selected range?

Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
Set MyRangeName = r
MyRangeName.Select
End Sub

--
Gary''s Student - gsnu200821


"Phil Smith" wrote:

Nope. It runs with no errors, but the cells covered by that range do
not change to the selected cells. The range remains the same...


Gary''s Student wrote:
Sub servient()
Dim r As Range
Set r = Application.InputBox(Prompt:="Select range", Type:=8)
Set MyRangeName = r
End Sub


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
Get user selected range into RefEdit J. Hall Excel Programming 2 April 9th 04 05:05 PM
Referring to a user-selected range James Mc Excel Programming 2 January 27th 04 07:46 AM
Identify User Selected Range RonF Excel Programming 3 January 12th 04 04:36 PM
Identify Range Selected By User RonF Excel Programming 1 January 9th 04 05:29 PM
Determining end of user-selected range Syed Faisal Excel Programming 2 October 23rd 03 05:22 PM


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