Solved

Last Update Date

Posted on 2011-02-20
7
257 Views
Last Modified: 2012-05-11
I have a spreadsheet and each time I open it it displays the current date.  I'd like a command or small macro that places in the cell below the current date the date the spreadsheet was last worked on.  If I use a simple copy/paste, it too will auto update each time I open the sheet.  Just to be clear, when the sheet is closed and then reopened a new date time will be established and the old one moved into the "date spreadsheet was last worked on".

Hard or easy?

B.
0
Comment
Question by:Bright01
  • 4
  • 3
7 Comments
 
LVL 37

Accepted Solution

by:
Neil Russell earned 500 total points
ID: 34936685
Use the following code


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
   Sheets("Sheet1").Range("A1").Value = Date
End Sub

Open in new window

0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34936693
Oh and of course change "sheet1" and "A1" to reflect the sheetname and cell that you want the date stored in.
0
 

Author Comment

by:Bright01
ID: 34936735
Neilsr,

I'm not sure what I'm doing wrong..... I cut/pasted your code into the Company_Profile tab in the Developer's tab, changed the spreadsheet name and the cell reference and saved/closed the workbook.  When I opened it....nothing.  I'm running 2010 if that makes any difference and I do have macros enabled............ any ideas?

B.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:Bright01
ID: 34936739
Oh... changed it to "This Workbook" and it worked great!  Much thanks.

B.
0
 

Author Closing Comment

by:Bright01
ID: 34936740
By the speed and simplicity, I'll take it as a "yes" that was easy!

Thanks,

B.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34936741
Developers tab, visual basic, paste code into This Workbook
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34936743
Glad to be of help
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question