ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto sort (https://www.excelbanter.com/excel-programming/402300-auto-sort.html)

Tanya

Auto sort
 
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

[email protected]

Auto sort
 
On 12月6日, 下午2时00分, Tanya wrote:
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

Tanya

Auto sort
 
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



"Tanya" wrote:

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



All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com