Hi
I have the following code that just puts some information into a couple of cells. This works fine and the company is using it.
However, I am now working on a version 2 to which I have added a few more cells and another worksheet just to make it a little easier to use. Now when I open the file I get the following error: Run-time error 57121 "Application-defined or object-defined error". As nothing has really changed and the old one still works (I copied the code) I'm stumped as to what the issue is.
Private Sub Workbook_Open()
ActiveSheet.Unprotect
If Worksheets("M+M Sheet").Cells(2, 11).Value = "" Then
Worksheets("M+M Sheet").Cells(2, 11).Value = Date
End If
If Worksheets("M+M Sheet").Cells(12, 5).Value = "" Then
Worksheets("M+M Sheet").Cells(12, 5).Value = UCase(Environ("USERNAME"))
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Any advice would be appreciated.
Thanks
Steve
I have the following code that just puts some information into a couple of cells. This works fine and the company is using it.
However, I am now working on a version 2 to which I have added a few more cells and another worksheet just to make it a little easier to use. Now when I open the file I get the following error: Run-time error 57121 "Application-defined or object-defined error". As nothing has really changed and the old one still works (I copied the code) I'm stumped as to what the issue is.
Private Sub Workbook_Open()
ActiveSheet.Unprotect
If Worksheets("M+M Sheet").Cells(2, 11).Value = "" Then
Worksheets("M+M Sheet").Cells(2, 11).Value = Date
End If
If Worksheets("M+M Sheet").Cells(12, 5).Value = "" Then
Worksheets("M+M Sheet").Cells(12, 5).Value = UCase(Environ("USERNAME"))
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Any advice would be appreciated.
Thanks
Steve