View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
brian thompson3001 via OfficeKB.com brian thompson3001 via OfficeKB.com is offline
external usenet poster
 
Posts: 13
Default VBA password protect

Hi Ernest

tried you alteration and the macro would not run. I copied and pasted into
"View Code" (right click on tab)

worksheet name "WTD"
Password "template"

any ideas why?


regards

ernestgoh wrote:
brian thompson3001 via OfficeKB.com Wrote:
Hi

[quoted text clipped - 25 lines]
--
bnt


hi brian,

you may use this :

Private Sub auto_Open()

Worksheets("-Name of your worksheet-").unprotect password:="template"

Sub averagesort()
Range("A6:AI36").Select
Selection.Sort Key1:=Range("C6"), Order1:=xlDescending,
Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlBottomToTop
ActiveWindow.ScrollRow = 6
Range("A3").Select

Worksheets("-Name of your worksheet-").protect password:="template"

End Sub

best regards, ernest goh


--
bnt

Message posted via http://www.officekb.com