Solved

Last Update Date

Posted on 2011-02-20
7
255 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
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)

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Skype for Business 10 71
KMS for Office 2013 clients 9 56
Abstract this sub 6 62
Excel Automation of Autosum 23 100
This collection of functions covers all the normal rounding methods of just about any numeric value.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now