ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic Cell Population (https://www.excelbanter.com/excel-programming/362199-automatic-cell-population.html)

EJ

Automatic Cell Population
 
I'm on a roll now...

How do I get cells to populate with the following on save?

Date
Time
Login name

This is probably easier to do than the last one!



Ardus Petus

Automatic Cell Population
 
Date : =Date
Time: = Date mod 1
Login name: = Environ("username")

HTH
--
AP

"EJ" a écrit dans le message de news:
...
I'm on a roll now...

How do I get cells to populate with the following on save?

Date
Time
Login name

This is probably easier to do than the last one!





colofnature[_11_]

Automatic Cell Population
 

Private Sub Workbook_BeforeClose(Cancel As Boolean)

[a1].Value = Now
[a2].Value = Environ("NWUSERNAME")

End Sub


Change a1 & b1 to whichever cells you want the info in.
Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=544777


ADG

Automatic Cell Population
 
try the below
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Worksheets("SHEET5").Cells(2, 3) = Int(Now()) ' DATE TO C2
Worksheets("SHEET5").Cells(4, 3) = Now() - Int(Now()) ' Time to C3
Worksheets("SHEET5").Cells(5, 3) = Environ$("Username") ' Windows username
to C4

End Sub

Change sheet name and cell refs
--
Tony Green


"EJ" wrote:

I'm on a roll now...

How do I get cells to populate with the following on save?

Date
Time
Login name

This is probably easier to do than the last one!



Tom Ogilvy

Automatic Cell Population
 
Environ("NWUSERNAME")

returns nothing for me - is that what you really intended?

--
Regards,
Tom Ogilvy


"colofnature" wrote:


Private Sub Workbook_BeforeClose(Cancel As Boolean)

[a1].Value = Now
[a2].Value = Environ("NWUSERNAME")

End Sub


Change a1 & b1 to whichever cells you want the info in.
Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=544777



colofnature[_16_]

Automatic Cell Population
 

Works for me - returns the ID I logged into the network with.
"Environ("USERNAME")" also works.


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=544777


Tom Ogilvy

Automatic Cell Population
 
Not for me.

Windows XP

and I have never seen it offered as a general solution. Username seems
much more robust. Are you on a Novell network. A google search seemed to
associate it with a Novell Network.

--
Regards,
Tom Ogilvy


"colofnature" wrote:


Works for me - returns the ID I logged into the network with.
"Environ("USERNAME")" also works.


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=544777



colofnature[_19_]

Automatic Cell Population
 

Yup, you're right, the office network is Novell. I just iterated the
environ(x) variables and picked the first one that returned a user
id... :rolleyes:

Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=544777



All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com