Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting data automatically
Hello All, Hope someone can help... I have a table in excel, range: c11:h584 where row C11:H11 contains th titles. What I would like to do is automatically sort the column by row G. I may want to change the macro to sort on different columns - is i possible to build this into the macro using a msgbox (for example) Is there a way to automate this sort function ? Many thanks for your help. Regards Scott -- scottwilson ----------------------------------------------------------------------- scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112 View this thread: http://www.excelforum.com/showthread.php?threadid=26272 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting data automatically
Turn on the macro recorder and select the range, then do Data=Sort and
select Column G. Turn off the macro recorder. Now you c an replace the Key1:=Range("G11") with a variable such as dim rng as Range On error resume next set rng = Application.Inputbox("Click mouse on a cell in the column to use for sorting",type:=8) On error goto 0 if not rng is nothing then Range("C11:H584").Sort _ Key1:=rng, Order1:=xlascending, _ headers:=xlYes Else Msgbox "Nothing selected, bye" exit sub End if -- regards, Tom Ogilvy "scottwilsonx" wrote in message ... Hello All, Hope someone can help... I have a table in excel, range: c11:h584 where row C11:H11 contains the titles. What I would like to do is automatically sort the column by row G. I may want to change the macro to sort on different columns - is it possible to build this into the macro using a msgbox (for example) Is there a way to automate this sort function ? Many thanks for your help. Regards Scott. -- scottwilsonx ------------------------------------------------------------------------ scottwilsonx's Profile: http://www.excelforum.com/member.php...o&userid=11128 View this thread: http://www.excelforum.com/showthread...hreadid=262722 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with automatically sorting data | Excel Worksheet Functions | |||
Data sorting automatically? | Excel Worksheet Functions | |||
Sorting Data Automatically | Excel Worksheet Functions | |||
Sorting data automatically | Excel Worksheet Functions | |||
Sorting Data Automatically | Excel Discussion (Misc queries) |