Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Am I 'Dim'

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"