ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort Based off of an Input Box (https://www.excelbanter.com/excel-programming/320298-sort-based-off-input-box.html)

Nathan Bell

Sort Based off of an Input Box
 
All,

In trying to finish off this macro and I am trying to find a way to do a
sort on a range. The column that I am sorting by is always teh same, but
the range will vary. Is there a way in VBA to pass along that range
variable to sort? I would ideally like the input box to be where you can
click the box on the right to select your own range from within excel and it
will populate that range automatically. Then that range would be passed
along to the sort macro. Any help would be greatly appreciated.

Nathan Bell



Nathan Bell

Sort Based off of an Input Box
 
All I really want to do is make the following Range("A6:G84").Select user
definable with teh input box that allows you to select the range from within
excel.

"Nathan Bell" wrote in message
...
All,

In trying to finish off this macro and I am trying to find a way to do

a
sort on a range. The column that I am sorting by is always teh same, but
the range will vary. Is there a way in VBA to pass along that range
variable to sort? I would ideally like the input box to be where you can
click the box on the right to select your own range from within excel and

it
will populate that range automatically. Then that range would be passed
along to the sort macro. Any help would be greatly appreciated.

Nathan Bell





Bob Phillips[_6_]

Sort Based off of an Input Box
 
Use Application.Inputbox, with Type:=8

On Error Resume Next
Set rng = Application.Inputbox("Select range",Type:=8)
If Not rng Is Nothing Then
rng.Sort
'etc.

The user would then use the mouse to select the range, or type it in the
editbox, and this is returned as a range object.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nathan Bell" wrote in message
...
All I really want to do is make the following Range("A6:G84").Select user
definable with teh input box that allows you to select the range from

within
excel.

"Nathan Bell" wrote in message
...
All,

In trying to finish off this macro and I am trying to find a way to

do
a
sort on a range. The column that I am sorting by is always teh same,

but
the range will vary. Is there a way in VBA to pass along that range
variable to sort? I would ideally like the input box to be where you

can
click the box on the right to select your own range from within excel

and
it
will populate that range automatically. Then that range would be passed
along to the sort macro. Any help would be greatly appreciated.

Nathan Bell








All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com