VB help please?

pam53154

Board Regular
Joined
Mar 3, 2009
Messages
107
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
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top