S
Sean
I have the following procedure run when I open up a particular file,
which will display for me the user name within Excel. I have the sheet
protected etc so it can't be tampered with. But I'm hitting a Compile,
I just don't understand these With, End With's
Private Sub Workbook_Open()
For Each sh In ActiveWorkbook.Worksheets
On Error Resume Next
sh.Unprotect Password = "1234"
Cells(6, 3).Value = Application.UserName
sh.Protect Password = "1234"
End Sub
which will display for me the user name within Excel. I have the sheet
protected etc so it can't be tampered with. But I'm hitting a Compile,
I just don't understand these With, End With's
Private Sub Workbook_Open()
For Each sh In ActiveWorkbook.Worksheets
On Error Resume Next
sh.Unprotect Password = "1234"
Cells(6, 3).Value = Application.UserName
sh.Protect Password = "1234"
End Sub