This version:
Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub
Would go into a General module.
(don't forget to adjust the worksheet name and password.)
You may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
=======
Short course:
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)
right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side
Paste the code in there.
Don't forget to lock the VBA Project, too. Else you'll have inquisitive types
looking at your code and seeing the password.
Inside the VBE, you can lock the project.
Tools|VBAProject Properties|Protection tab.
Give it a memorable password and lock the project for viewing.