I currently have a sheet setup so that the bottom line of the sheet reads the same as the footer, and the footer is set by the text in that line. That way when I need to change the footer I can simply change that line and not have to deal with going into the page setup, etc. I password protected the cell with a Worksheet_Change event and that all works perfectly in preventing the footer from being changed without proper access. The problem I have is that I would like to find a way to copy the cells original value (say on a Worksheet_Activate event) so that if the user changes that lower line and does not have access, that cell value will go back to the original text instead of the change that the user made.
I hope that makes sense. Here is what I currently have. Everything works out great as far as errors, etc. But if the password is entered incorrectly all it does is clear the cell rather than inserting the original text.
Thanks in advance for the help!
I hope that makes sense. Here is what I currently have. Everything works out great as far as errors, etc. But if the password is entered incorrectly all it does is clear the cell rather than inserting the original text.
Code:
Private Sub Worksheet_Activate()
FooterText = Sheets("Home").Range("Footer").Text
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("Footer")) Is Nothing Then
Password = InputBox("Please Enter Password to Change Footer", "Change Page Footer")
If Password = "Atlascopco" Then
ActiveSheet.PageSetup.CenterFooter = Format(Sheets("Home").Range("Footer").Value)
Else: MsgBox "You are not authorized to make this change", vbOKOnly, "Password Incorrect"
Application.EnableEvents = False
Sheets("Home").Range("Footer").Value = FooterText
Application.EnableEvents = True
End If
End If
End Sub
Thanks in advance for the help!