View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roy Wagner Roy Wagner is offline
external usenet poster
 
Posts: 28
Default Worksheet Revision Date update only once in the same day

How about this? The workbook decides as usual whether or not it needs to ask
you if it should be saved. If you elect to save, the BeforeSave event is
triggered. It checks the existing revision level against the value calculated
for that day. It is automatically updated only if it does not match today's
calculated value. In my example, I located the Revision stamp on sheet1 in
cell A1. You can put it wherever you want it. You can also alter the text and
date formatting to suit your situation. It doesn't slow things down
noticeably, since the event only occurs when you save your work.

To install it, use ALT-F11 to bring up the VB Editor.
Assuming there is no code in the workbook now, paste the code below into the
code window. If you already have some code, make sure this gets put into the
workbook beforesave event.

Give it a shot.

Roy

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

If Sheet1.Range("A1").Value < "Revision " & Format(Date, "mm-dd-yyyy") Then
Sheet1.Range("A1").Value = "Revision " & Format(Date, "mm-dd-yyyy")
End If

End Sub

Of course, a time stamp could be added as well, but his would increase
revision changes depending on the way you formatted the time, i.e., down to
the hour, minute or second.



"mikeburg" wrote:


I put a revision date in a cell (today's date) when I change a
worksheet. If I merely print, view or something without actually
changing the worksheet, I do not update the revision date even if I
happen to save it again.

I need the worksheet to automatically update the worksheet revision
date only once for that day and only when the worksheet is changed (or
only once after it's opened & changed will work just as well).

I am trying to avoid changing the date every time the worksheet is
changed since it's not necessary to change the date to the same date
every time a change is made. More importantly, changing the revision
date every time the worksheet is changed causes data entry to be
slower.

I prefer not to use the today function in a cell that changes every
time the worksheet is opened because the worksheet is not updated every
time it's opened. Also, doing so causes Excel to prompt to save on exit
of the worksheet when all I've done is printed or viewed the data.

I need to hear everyone's ideas how to do this even if there
differences of opinions. Please?

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=395970