HI All,
Trying to design a Macro which will automatically unlock the workbook and do hide or unhide a Worksheet. What will trigger the Macro will be a value change in a cell. The problem is, the password is not constant. One week it will be one word and the next it will be something else. I have designed one where the password is the same all the time:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Me.Range("H1").Address Then
If Target.Value = "5" Then
ActiveWorkbook.Unprotect "password"
Sheets("W5").Visible=True
ActiveWorkbook.protect "password"
Else
ActiveWorkbook.Unprotect "password"
Sheets("W5").Visible=False
ActiveWorkbook.protect "password"
End if
End if
End Sub
I want so that whatever the workbook password that the user has used to protect the work book in the first place will remain the same. For example I have lock my workbook, but my password is "Excel 1". The following month I will change it to "Excel 2". I do not actually want to show the password in the Macro. Is there a macro for this?
Please can somebody help.
Thanks
Trying to design a Macro which will automatically unlock the workbook and do hide or unhide a Worksheet. What will trigger the Macro will be a value change in a cell. The problem is, the password is not constant. One week it will be one word and the next it will be something else. I have designed one where the password is the same all the time:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Me.Range("H1").Address Then
If Target.Value = "5" Then
ActiveWorkbook.Unprotect "password"
Sheets("W5").Visible=True
ActiveWorkbook.protect "password"
Else
ActiveWorkbook.Unprotect "password"
Sheets("W5").Visible=False
ActiveWorkbook.protect "password"
End if
End if
End Sub
I want so that whatever the workbook password that the user has used to protect the work book in the first place will remain the same. For example I have lock my workbook, but my password is "Excel 1". The following month I will change it to "Excel 2". I do not actually want to show the password in the Macro. Is there a macro for this?
Please can somebody help.
Thanks