Results 1 to 4 of 4

Thread: insert date

  1. #1
    a1pablo
    Guest

    insert date

    hi

    i made a template pretty basic but i use it to do my payroll every day and multiple times a day i need to input the current date . i would love to have a button to insert the current date in the cell that i chose . is this possible ? if so could anyone give me a point in the right direction ?i have included a blank page so you can see what i am talking about.also i use excel 97 sr-2

    thanks in advance

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: insert date

    I have placed a button on the sheet you posted (A1:A2) that will insert the current date as static, i.e. it will not update. The code is as follows, and hopefully will insert the date in a suitable format.<pre>Sub DateInsert()
    tDate = Now()
    ActiveCell.Value = Format(tDate, "Short Date")
    End Sub</pre>

    You can achieve the same result by pressing Ctrl and ;(semi colon) at the same time.
    Attached Files Attached Files

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: insert date

    You don't really need a macro, just hold down the Ctrl key and press semi-colon to insert the date into the active cell. If you want the time, then use Ctrl+Shift+Colon. If you want the date and time, then a macro like the one below, assigned to a button on a tool bar, will do it:

    <pre>Public Sub InsertDateTime()
    ActiveCell.Value = Now()
    ActiveCell.Offset(0, 1).Select
    End Sub
    </pre>

    Legare Coleman

  4. #4
    a1pablo
    Guest

    Re: insert date

    <img src=/S/joy.gif border=0 alt=joy width=23 height=23> thank you that is just what i needed.

Posting Permissions

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