View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
hotherps[_151_] hotherps[_151_] is offline
external usenet poster
 
Posts: 1
Default Protect sheets w/o user password prompt


This is the code that locks the workbook

Dim Sht As Worksheet
Const Pass As String = "hello"

On Error Resume Next
For Each Sht In ThisWorkbook.Worksheets
With Sht
.cells.Locked = False
.cells.SpecialCells(xlCellTypeFormulas).Locked = True
.Protect UserInterfaceOnly:=True, Password:=Pass

End With
Next Sht


This is the sort code

Range("A4:AY298").Select
Selection.SORT Key1:=Range("A4"), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
_
DataOption1:=xlSortNormal

Range("A4").Selec

--
hotherp
-----------------------------------------------------------------------
hotherps's Profile: http://www.excelforum.com/member.php...nfo&userid=505
View this thread: http://www.excelforum.com/showthread.php?threadid=32005