+ Reply to Thread
Results 1 to 4 of 4

Timestamp (Date+Time) macro?

  1. #1
    Registered User
    Join Date
    09-01-2006
    Posts
    1

    Question Timestamp (Date+Time) macro?

    Okay, I am trying to make it possible to time-stamp with a single command (i.e. Ctrl+t). Basically I want to make a macro that does "Ctrl+;, Space, Ctrl+:" but my Visual Basic knowledge is lacking and 'record' saves the data, not the keystrokes.

    I've already figured out that Ctrl+; translates into (ActiveCell.Value = Date) and Ctrl+: to (ActiveCell.Value = Time) - however I don't know how to reword the commands to include both date and time in the same cell. Any help would be appreciated!

    Mike

  2. #2
    Forum Contributor
    Join Date
    01-06-2004
    Location
    Carbondale CO
    Posts
    245
    Try,

    Sub DateTimeStamp()

    With ActiveCell
    .NumberFormat = "[$-409]m/d/yy h:mm AM/PM;@"
    .Value = Now()
    End With

    End Sub

    Then go to TOOLS>MACRO>MACROS (find the DateTimeStamp macro)>OPTIONS (set a shortcut key)

    HTH
    Casey

  3. #3
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226
    Paste this into a Module :

    Sub DateStamp()
    ActiveCell.Formula = Date & " " & Time
    End Sub

    Then you go to Excel, hit Alt + F8, select 'DateStamp', then select 'Options' and there you can specify e.g. Ctrl+t as a shortcut key combination.

    Gabor

  4. #4
    Forum Contributor
    Join Date
    03-15-2005
    Location
    North Carolina
    MS-Off Ver
    2003 & 2007
    Posts
    180
    Try
    Activecell.value = Date & " " & Time

    HTH

    Jason

+ 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