I am trying to enhance security in a spreadsheet which requires an "electronic signoff." Currently the person who has approved information in the spreadsheet types their name in a certain cell as the signoff. In order to authenticate the identity of that person, I added code which inserts the username through Environ("username"), then protects the cell with the user name in it. But, the weakness is that after the spreadsheet has been "signed" there may be future legitimate changes which need to be made. So, I would like to add code that removes the original username upon any changes made subsequent to the original signoff and requires a new signoff after such changes. I'm thinking something like: IF (changes made subseqent to signoff) <CHANGES signoff after made are>THEN (remove existing signoff and require a new one)<REMOVE signoff new require and exisiting>. In theory this seems like something that can be done but I'm still learning the ropes on VB so I'm reaching out for help. Thanks!!
Here's the code I have so far:
Range("B1").Select
ActiveCell.FormulaR1C1 = Environ("username")
Cells.Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("B1").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
Here's the code I have so far:
Range("B1").Select
ActiveCell.FormulaR1C1 = Environ("username")
Cells.Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("B1").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True