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