Multiple passwords

WatfordKev

Board Regular
Joined
Mar 30, 2011
Messages
78
When opening a worksheet, I'd like for more than one password to be available. Ideally I'd like to subsequently use that information as an audit trail on my workbook, so I can check for instance when the last time user1 or user2 logged in! ...NB I will tell them in advance that I will be doing this!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Why not just use the Workbook Open event and add a basic audit trail to say who came in and when. You would use the Environ("UserName") to do this. Create a log sheet. Open your workbook then use Alt + F11 then on left side of screen double click thisworkbook then change first drop down to Workbook.

So something like this would work.

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_BeforeClose(Cancel <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>)<br>Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br>Sheets("Log").Activate<br>Range("d2").Select<br><SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">Until</SPAN> ActiveCell.Value = ""<br>ActiveCell.Offset(1, 0).Select<br><SPAN style="color:#00007F">Loop</SPAN><br>ActiveCell.Value = Environ("UserName")<br>ActiveCell.Offset(0, 1) = <SPAN style="color:#00007F">Date</SPAN><br>ActiveCell.Offset(0, 2) = Time<br>Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()<br>Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN><br>Sheets("Log").Activate<br>Range("A2").Select<br><SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">Until</SPAN> ActiveCell.Value = ""<br>ActiveCell.Offset(1, 0).Select<br><SPAN style="color:#00007F">Loop</SPAN><br>ActiveCell.Value = Environ("UserName")<br>ActiveCell.Offset(0, 1) = <SPAN style="color:#00007F">Date</SPAN><br>ActiveCell.Offset(0, 2) = Time<br>Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN><br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
Thanks Trevor, I've had some great fun with that code, I'm using it to timestamp and log changes to all kinds of stuff in my workbook!
 
Upvote 0
Pleased to read you are working with the code, and it is working for you Kev.;):laugh:
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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