Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am using Excel 2000 and have created a workbook with 3 worksheets which I
have tried to protect with the code . Private Sub Workbook_Open() 'This macro automatically protects the worksheets on opening, allows macros to run, and allows limited formatting 'before going to the 'Date cell. Sheets(1).Protect Password:="secret", UserInterfaceOnly:=True Sheets(2).Protect Password:="secret", AllowInsertingRows:=True, AllowDeletingRows:=True, AllowSorting:=True Sheets(3).Protect Password:="secret", AllowInsertingRows:=True, AllowSorting:=True It accepts the first line but comes up with 'run-time 1004 error due to App. or Obj. defined error' somewhere on the line starting 'Sheets(2)'. I'm trying to teach myself VBA from a book so please be gentle with me if it's a simple error. GrahamB |