GomaPile
Active Member
- Joined
- Jul 24, 2006
- Messages
- 334
- Office Version
- 365
- Platform
- Windows
Good morning World
VBA below Ive done something wrong. Could someone please have a look.... thanks in advance.
Cheers
GomaPile (NASA2)
VBA below Ive done something wrong. Could someone please have a look.... thanks in advance.
VBA Code:
Private Sub Workbook_Open()
Dim ws As Variant, MyArray As Variant
MyArray = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
For Each ws In MyArray
If UserIsAllowedToEdit Then
' Unprotect the sheet with password (if required)
ws.Unprotect "test"
Next ws
Else
ws.Range("C:C").Locked = False ' Unlocked
ws.Range("G:G").Locked = False ' Unlocked
ws.Protect "test", UserInterfaceOnly:=True
End If
UserForm3.Show
End Sub
Cheers
GomaPile (NASA2)