View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Macro error when trying to open workbook

Hi again

You havent mentioned what the error is..

"paankadu" wrote:

I have been using this macro in several workbooks... each has a spearate
password and it has been working great... until I get to my latest workbook

I protect the sheets and have this code in the "This Workbook" so when it
opens it will update the date in each worksheet.. I have gone in and verified
my password for each sheet, have taken the protection off and put it back on
being very careful to make sure I am not misspelling anything, have changed
passwords and keep getting the same error. This is the same code I have used
in about 7 other workbooks (just changing the password for each one). I have
even deleted the code out and typed it in from scratch.

Anyone have any ideas why I am getting this error on only 1 workbook?


Private Sub Workbook_Open()
Dim Sh As Worksheet
For Each Sh In Sheets
With Sh
.Unprotect Password:="bear"
.Range("g2") = Date
.Protect Password:="bear"
End With
Next
End Sub

--
Thanks,
Angie