+ Reply to Thread
Results 1 to 8 of 8

Automatic Cell Population

Hybrid View

  1. #1
    EJ
    Guest

    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!



  2. #2
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    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

  3. #3
    Tom Ogilvy
    Guest

    Re: 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
    >
    >


  4. #4
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    Works for me - returns the ID I logged into the network with. "Environ("USERNAME")" also works.

  5. #5
    Tom Ogilvy
    Guest

    Re: 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
    >
    >


  6. #6
    Ardus Petus
    Guest

    Re: Automatic Cell Population

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

    HTH
    --
    AP

    "EJ" <EJ@discussions.microsoft.com> a écrit dans le message de news:
    9260D3C5-9362-4F64-B029-9BE7317361ED@microsoft.com...
    > 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!
    >
    >




  7. #7
    ADG
    Guest

    RE: 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!
    >
    >


  8. #8
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    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...

    Col

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1