ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customizing "sort" macro (https://www.excelbanter.com/excel-programming/365068-customizing-sort-macro.html)

markx

Customizing "sort" macro
 
Hello guys,
Just one quick question concerning "Sort" macro...

I have the following code:

Sub SortAscending()
Range("A1:A10000").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"E1"), Unique:=True
Range("E1:E10000").Select
Selection.SpecialCells(xlCellTypeBlanks).Delete (xlShiftUp)
Range("E1:E10000").Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=
_
xlYes
End Sub

What I would like to do is to give the user the opportunity to choose/adapt
input and output columns, f. ex. with small window apprearing and asking:
Input column? ...
Output column? ...

Is it something easy to do?
Do you have other (better) ideas how to achieve this?

Many thanks,
Mark



Bob Phillips

Customizing "sort" macro
 
Try

Set rng = application.,Inputbox("Use the mouse to select a column",
Type:=8)
If not rng Is Nothing then
inputcol = rng.Column
End If

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"markx" wrote in message
...
Hello guys,
Just one quick question concerning "Sort" macro...

I have the following code:

Sub SortAscending()
Range("A1:A10000").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"E1"), Unique:=True
Range("E1:E10000").Select
Selection.SpecialCells(xlCellTypeBlanks).Delete (xlShiftUp)
Range("E1:E10000").Sort Key1:=ActiveCell, Order1:=xlAscending,

Header:=
_
xlYes
End Sub

What I would like to do is to give the user the opportunity to

choose/adapt
input and output columns, f. ex. with small window apprearing and asking:
Input column? ...
Output column? ...

Is it something easy to do?
Do you have other (better) ideas how to achieve this?

Many thanks,
Mark






All times are GMT +1. The time now is 06:08 PM.

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