macro for sorting in protected sheet
Hi all
I created a button in a protected worksheet to allow sorting of data in
column A6 to A60 which does not work. Pls help.
I used the following code which I found in the discussion group. What I need
is to sort only a range of datas in one column, eg A6 to A60
Sub sortit()
Dim coltosort As Range
Set coltosort = Application.InputBox(Prompt:= _
"Select A Column", Type:=8)
ActiveSheet.Unprotect Password:="justme"
ActiveSheet.UsedRange.Sort Key1:=coltosort.Cells(2), _
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
With ActiveSheet
...Protect Password:="justme"
...EnableSelection = xlNoRestrictions
End With
End Sub
|