Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: DateStamp a worksheet

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there a simple way to Date/TimeStamp a worksheet when a user launches a marco?
    i.e. Run marco and it adds cell contents to A1 that read "Completed by Joe on Feb-20-2002".
    Thanks.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi John,

    Yes, just add this line to the macro. It will add the datestamp to cell A1 on the active worksheet:

    [a1] = "Completed by Joe on " & Format(Date, "mmm-dd-yy")

    if you always want it added to a particular worksheet, regardless of whether it is the active sheet then:

    Worksheets("MySheet").[a1] = "Completed by Joe on " & Format(Date, "mmm-dd-yy")
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,584
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi there jpettit

    Put this in your macro code:
    Range("A1").Value = "Completed by Joe on " & Date
    End Sub

    Derek

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks very much...that works well.
    Additionally, is there a way to pull in the username (from WinNT) as:
    "Completed by USERNAME on 01/01/01" ??


  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    this takes the username from whatever the username is in excel. If you're trying to get the actual Windows username, I'm sure theres a way to do that, but I'm not too sure about how anyway, heres the excel username:

    [a1] = "Completed by " & Application.UserName & " on " & Format(Date, "mmm-dd-yy")

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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