Solved

Last Update Date

Posted on 2011-02-20
7
254 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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 …

757 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

20 Experts available now in Live!

Get 1:1 Help Now