-VMill said:
Thanks for the suggestion, however, I really need a solution that does not
rely on a user enabling macros.
-VMill
Hi -VMill,
If you add an extra worksheet and name it "Must Enable Macros" you can
use the following codes to hide the worksheets except for "Must Enable
Macros" which can also instruct the user to close the workbook then
reopen and click on "Enable macros". If the user follows the
instruction the reopened workbook will have visible sheets and will be
able to work on them and will not be able to select your protected
cells because the code also reinstates the xlUnlockedCells selection
property.
Use the same password for protecting each sheet and insert that
password into the speech marks in the code where you see Password:=
""....
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
Worksheets("Must Enable Macros").Visible = xlSheetVisible
Dim Sht As Worksheet
For Each Sht In Me.Worksheets
On Error GoTo PROTECTED
If Sht.Name <> "Must Enable Macros" Then
Sht.Visible = xlSheetVeryHidden
End If
Next Sht
Exit Sub
PROTECTED:
Sht.Unprotect password:=""
Sht.Visible = xlSheetVeryHidden
Sht.Protect password:=""
Resume Next
End Sub
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim Sht As Worksheet
For Each Sht In Me.Worksheets
Select Case Sht.Name
Case "Must Enable Macros"
On Error GoTo PROTECTED
Sht.Visible = xlSheetVeryHidden
Case Else
Sht.Visible = xlSheetVisible
Sht.EnableSelection = xlUnlockedCells
End Select
Next Sht
Exit Sub
PROTECTED:
Worksheets(Worksheets.Count - 1).Unprotect password:=""
Sht.Visible = xlSheetVeryHidden
Worksheets(Worksheets.Count - 1).Protect password:=""
Resume Next
End Sub
Both lots of go go into the ThisWorkbook code module as before
Ken Johnson