View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
broro183
 
Posts: n/a
Default Fix Excel Protection so that it works as published


Hi Christopher

I'm trying to overcome exactly the same problem (sorting a protected
sheet) at the moment & am just checking threads to see if there is a
method of adding default arguments to the following "SortSheet" code
which I have attached to a commanbutton. Please note that I have set
the sheet up with "userinterface only" protection using:
Private Sub Workbook_Open()
Dim Password As String
Password = "secret"
Sheets("sheet1").Protect Password:=Password, _
UserInterFaceOnly:=True
End Sub

Add a named range "sort_area", give the below a go & see if it helps -
I think it is much better than asking users not to make errors, after
all we are all human!

Sub SortSheet()
'to allow sheet sorting on the "user interface only" protected sheet &
requires use of a _
named range "Sort_Area"
Range("'" & ActiveWorkbook.Name & "'!Sort_Area").Select
Application.Dialogs(xlDialogSortSpecial).Show
'optional MsgBox "Page is sorted as requested."
End Sub

hth,
Rob Brockett
NZ
Always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=501367