Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to write a piece of code which will present users with an input box (asking for a number) which will then select the current range and sort it using the variable defined by the input box. How would I use the numeric variable as the key to sorting my data. Example: mynumber = InputBox("Please enter the column number that you want the data splitting by") Range("A1").Select ActiveCell.CurrentRegion.Select Selection.Sort Key1:=mynumber, Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom The problem must be around my storing a number as the variable but the sort command would appear to want a string??? Please help... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code for variable sort order | Excel Discussion (Misc queries) | |||
VBA Variable Range Sort | Excel Discussion (Misc queries) | |||
Variable Column Sort | New Users to Excel | |||
How do I use a variable in a sort macro | Excel Worksheet Functions | |||
Sort : how can I use a variable in a VB sort function? | Excel Worksheet Functions |