reference id

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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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