Auto sort

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
 
A

alext49

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
 
T

Tanya

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top