I've found the code shown to Password Protcet a sheet, but I keep getting a Compile Error saying Variable Not Defined, can anyone help please?
![]()
Option Explicit Private Sub Worksheet_Activate() Dim pwd As String: pwd = "password" Cells(Rows.Count, Columns.Count).Activate If Application.InputBox("What is the password to view this sheet?", "Access Password", "???") <> pwd Then Sheets("Sheet1").Activate MsgBox "Wrong password" Else Range("A1").Activate End If End Sub
Bookmarks