amnogeek

New Member
Joined
Feb 23, 2009
Messages
1
I have a workbook that can be opened by different users at the same time. My goal is to ID each time it is being opened so it can be saved by that ID.

What I am thinking is to date, time and user stamp the workbook everytime it is being opened. And because it needs to be unique, a database that lists all the IDs will be helpful. (?)

I have a macro that creates the userid but I am having trouble with the date and time because it changes everytime a work is being done. Please help.


Example:
1. user1 opens the workbook
2. workbook will generate an id xxxx01
first 4 digits = date and time stamp
last 2 digits = userid

3. user2 opens the workbook
4. workbook will generate an id xxxx02

The workbook will then use this id as its filename.

Thanks for your help
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Not sure this is what you need:

but this piece ( when pasted in the this workbook module )

will put an id in a new row in a sheet called USERID , you can hide this and pick the last one ( in theory ) to save it by.

Code:
Private Sub Workbook_Open()

'Get last row in sheet
LR = Worksheets("USERID").Range("A65536").End(xlUp).Row + 1

'to be replaced with your userid code
usr = "01"
'date time format ,change dmmyyhh to what you wish
dte = Format(Now, "dmmyyhhs")

'write the unique id to Userid sheet
Worksheets("USERID").Cells(LR, 1).Value = dte & usr


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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