Macro assistance
Hi Rover,
'This code into the ThisWorkbook:
Private Sub Workbook_Open()
Const arrAllowedUsers = "Rover;Peter;Sue;Mary"
If InStr(arrAllowedUsers, Environ("username")) 0 Then _
bMacroAllowed = True
End Sub
'This code into a module:
Option Explicit
bMacroAllowed As Boolean
Sub Protect_Selected_Sheets()
If Not (bMacroAllowed) Then Exit Sub
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Protect Password:="plan"
Next ws
End Sub
Sub UnProtect_Selected_Sheets()
If Not (bMacroAllowed) Then Exit Sub
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Unprotect Password:="plan"
Next ws
End Sub
Rgds. Hansueli
|