+ Reply to Thread
Results 1 to 7 of 7

Macro button to insert current date

  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Macro button to insert current date

    Hey everyone looking for some help coding a button that will automatically insert the current date into the selected cell, running into problems with people putting the wrong dates in a worksheet. I want to code a button that will eliminate any human error.

  2. #2
    Registered User
    Join Date
    07-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro button to insert current date

    FI Gurnee.xlsx

    Here is an example of the document if needed.

  3. #3
    Registered User
    Join Date
    10-18-2008
    Location
    michigan
    MS-Off Ver
    2010
    Posts
    88

    Re: Macro button to insert current date

    Hi,
    I made an icon on the ribbon that uses the following codes to enter todays date in a cell
    The codes are in my “personal workbook”. That way it can be used in any workbook.

    HTML Code: 
    The reason for the second macro (absolute) is if the cell is not saved using the “paste special” option of values, the date will change each day

    There may be a shorter macro to do all this.

    I never looked for one because, if it ain’t broke, don’t fix it

    Mike

  4. #4
    Registered User
    Join Date
    07-12-2012
    Location
    New Hampshire, United States
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro button to insert current date

    Please Login or Register  to view this content.
    is a more efficient way.

  5. #5
    Registered User
    Join Date
    07-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro button to insert current date

    Just need to know, when I create the button and run the code, it inserts the date in the selected cell. But then when I try to duplicate the process, as in highlight the cell and push the button it does not work again. Any particular reason for this that you can think of?

  6. #6
    Registered User
    Join Date
    07-12-2012
    Location
    New Hampshire, United States
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Macro button to insert current date

    I'm not sure what you mean. If the date is already in there and you click the date button nothing is going to change because it is already there. Also make sure you put the code in a module, not once of your sheet objects. In case you do not know how: to add a new module go to your code (alt + f11 or Developer tab then view code) and click the drop down arrow to the left of the save button in the top left of the screen, then insert new module. You can also right click in the object viewer on the left and click insert then new module.

  7. #7
    Registered User
    Join Date
    07-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro button to insert current date

    I figured it out, thanks for your help. I ended up using this, and it worked. Thank you for your input.

    Please Login or Register  to view this content.
    Last edited by Cutter; 07-27-2012 at 05:20 PM. Reason: Added code tags

+ 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