+ Reply to Thread
Results 1 to 7 of 7

I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

  1. #1
    Registered User
    Join Date
    05-18-2016
    Location
    Dayton
    MS-Off Ver
    Excel 2010
    Posts
    6

    I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Hello All,

    I hope everyone is having a good day. I am new to the forum as of today and I might as well be just as new to Macros/VBA codes.

    I am struggling to be able to insert a code that will give me a date and time stamp in a given cell after I hit the save button.

    I have this same function in a separate excel sheet that was emailed to me but it seems it is tied to another sheet that I don't have access to because when I open the visual basic dialogue box there is no code present.

    Basically, within this sheet that was emailed to me, when I hit SAVE a pop up window appears that says "UPDATE" and withing the box it asks....would you like to update CELL D2 with the current date and time?

    At this point, I can either day YES, NO, or CANCEL.

    I would like to recreate this code in a new sheet but I have no idea how to do so. I have browsed these forums and pasted codes into my document but I can't get anything to function.

    Also, is there a way to create a copy of the document after it is saved and timestamped?

    I appreciate any help that can be provided.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Look in the VB Environment for the Workbook_BeforeSave event macro. That's where you'll find the code that causes the pop up message box. In that macro just add the following

    Please Login or Register  to view this content.
    where Sheet1 is the VB Code name of the sheet in which you want to see the Date & Time.

    To Create a Copy just add a line of code

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-18-2016
    Location
    Dayton
    MS-Off Ver
    Excel 2010
    Posts
    6
    Quote Originally Posted by Richard Buttrey View Post
    Look in the VB Environment for the Workbook_BeforeSave event macro. That's where you'll find the code that causes the pop up message box. In that macro just add the following

    Please Login or Register  to view this content.
    where Sheet1 is the VB Code name of the sheet in which you want to see the Date & Time.

    To Create a Copy just add a line of code

    Please Login or Register  to view this content.
    Richard,

    Thank you so much for the prompt reply. I have stepped away from my computer for a moment but I will try these steps as soon as I'm back on. Again I really appreciate it

  4. #4
    Registered User
    Join Date
    05-18-2016
    Location
    Dayton
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Hello,

    I've been trying to accomplish the above code but I have been unsuccessful. I don't have any code present in my VB Environment.

    I am looking at a blank window in VBA Project box.

    What is the entirety of the code I should see?

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Hi,

    You need to double click the Workbook Object in the Project Explorer pane of the VBE. Then in the right hand window in the left hand drop down choose 'Workbook' (the default Workbook open procedure will be opened - ignore that. In the right hand drop down choose the BeforeSave item

    You code should be placed in this procedure. You should be able to see the same procedure in the workbook you already have and which you mentioned in your first post.

  6. #6
    Registered User
    Join Date
    05-18-2016
    Location
    Dayton
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Richard,

    Thank you. I have made it to the point described above. Would you be able to walk me through the codes you described above regarding input of the date and time stamp and creating a copy of the file?

    I have input Sheet1.Range("A1") = Now
    and below that,

    ActiveWorkbook.SaveAs Filename:="test"

    I am not seeing this macro run in my sheet yet, however. Have i entered the code incorrectly? How do I choose where to save the copied files?

  7. #7
    Registered User
    Join Date
    05-18-2016
    Location
    Dayton
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I would like to add a date and time stamp to a cell in Excel 2010 by hitting save

    Okay Richard,

    I have successfully gotten the time stamp macro to run, thanks to you!

    I am still having trouble with creating a copy for my sheet. I would like to create a copy every time the file is saved and store the copy in a specific location....is this possible?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Save File with Date and Time Stamp
    By Andibevan in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-26-2019, 12:46 AM
  2. [SOLVED] Convert Unix Date-time stamp to excel date and/or time columns
    By judikz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-13-2015, 05:46 PM
  3. [SOLVED] Process of using date stamp macro - Excel 2010
    By Claudia89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2014, 07:19 AM
  4. How to time stamp in excel 2010 using macros??
    By chem office worker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2013, 07:22 PM
  5. [SOLVED] Extract a time from a cell with date and time stamp and then perform calculations
    By Marcos Aristotelous in forum Excel General
    Replies: 3
    Last Post: 10-31-2012, 04:36 AM
  6. Macro to Save file with date/time stamp
    By tt388 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-31-2008, 11:24 AM
  7. Save file with time date stamp
    By oberon.black in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2005, 09:05 PM

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