Help, How do I merge these two Workbook_Open() into one?
Private Sub Workbook_Open()
''''''''''''''''''''''''''''''''''''''''''''''''
' Unhide the sheets. This Workbook_Open event
' will run only if macros are enabled. If macros
' are not enabled, this code will not run and
' only the introduction sheet will be visible.
''''''''''''''''''''''''''''''''''''''''''''''''
UnHideSheets
End Sub
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If Left(ws.Name, 2) < Format(Date, "mm") Or (Left(ws.Name, 2) = Format(Date, "mm") And Right(ws.Name, 2) < Format(Date, "dd")) Then
ws.Protect Password:="abc"
Else
ws.Unprotect Password:="abc"
ws.Cells.Locked = True
End If
Next
End Sub
Bookmarks