Auto sort

  • Thread starter Thread starter Tanya
  • Start date Start date
T

Tanya

Hi
I have a sheet with a range A6:BP6 and I want to be able to sort by column
after a message prompt to select the column to sort by. Is this possible?
I have tried autofilter and it has been messy. One of the problems I have
had is i need to protect the cells in the worksheet so my code needs to
unprotect the worksheet, sort, then reprotect.
Any help appreciated.
Thanks
Tanya
 
Hi
I have a sheet with a range A6:BP6 and I want to be able to sort by column
after a message prompt to select the column to sort by. Is this possible?
I have tried autofilter and it has been messy. One of the problems I have
had is i need to protect the cells in the worksheet so my code needs to
unprotect the worksheet, sort, then reprotect.
Any help appreciated.
Thanks
Tanya

good
 
I have solved my problem

Private Sub CommandButton1_Click()
UnProtect_Workbook
Application.Goto Reference:="RANKING"
ActiveWindow.SmallScroll Down:=-9
'Sort by Sem-1 Rank
Selection.Sort Key1:=Range("L2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll ToRight:=2
Protect_Workbook

End Sub
 
Back
Top