Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Last Update Date

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
Bright01
Asked:
Bright01
  • 4
  • 3
1 Solution
 
Neil RussellTechnical Development LeadCommented:
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
 
Neil RussellTechnical Development LeadCommented:
Oh and of course change "sheet1" and "A1" to reflect the sheetname and cell that you want the date stored in.
0
 
Bright01Author Commented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Bright01Author Commented:
Oh... changed it to "This Workbook" and it worked great!  Much thanks.

B.
0
 
Bright01Author Commented:
By the speed and simplicity, I'll take it as a "yes" that was easy!

Thanks,

B.
0
 
Neil RussellTechnical Development LeadCommented:
Developers tab, visual basic, paste code into This Workbook
0
 
Neil RussellTechnical Development LeadCommented:
Glad to be of help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now