ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date each active tab upon save (https://www.excelbanter.com/excel-discussion-misc-queries/116468-date-each-active-tab-upon-save.html)

Ken King

Date each active tab upon save
 
I would like to write a macro that would write the date & time to a cell in
the active worksheet tab, the same location for each tab, upon saving the
workbook. Could someone help me with this macro?

Thanks,
Ken

Gary''s Student

Date each active tab upon save
 
Sub demo()
Dim w As Worksheet
For Each w In Worksheets
w.Activate
Range("A1") = Now()
Next
End Sub
--
Gary's Student


"Ken King" wrote:

I would like to write a macro that would write the date & time to a cell in
the active worksheet tab, the same location for each tab, upon saving the
workbook. Could someone help me with this macro?

Thanks,
Ken


John Collins

Date each active tab upon save
 
Gary''s Student wrote:
Sub demo()
Dim w As Worksheet
For Each w In Worksheets
w.Activate
Range("A1") = Now()
Next
End Sub


I think the writer asks for a way to mark only the active sheet each
time a book is saved. If you put it into auto close, then it could run
when the book is closed.

Sub auto_close()
Activesheet.Range("A1").Value = Now()
End Sub

I don't know how to modify ActiveWorkbook.Save so that it includes the
desired code. As an alternative, instead of using the File:Save menu or
the Save button, you could create your own menu item or toolbar button
called MarkandSave that had the following code.

Sub MarkandSave
Activesheet.Range("A1").Value = Now()
Activeworkbook.Save
End Sub

John

Ken King

Date each active tab upon save
 


"John Collins" wrote:

Gary''s Student wrote:
Sub demo()
Dim w As Worksheet
For Each w In Worksheets
w.Activate
Range("A1") = Now()
Next
End Sub


I think the writer asks for a way to mark only the active sheet each
time a book is saved. If you put it into auto close, then it could run
when the book is closed.

Sub auto_close()
Activesheet.Range("A1").Value = Now()
End Sub

I don't know how to modify ActiveWorkbook.Save so that it includes the
desired code. As an alternative, instead of using the File:Save menu or
the Save button, you could create your own menu item or toolbar button
called MarkandSave that had the following code.

Sub MarkandSave
Activesheet.Range("A1").Value = Now()
Activeworkbook.Save
End Sub

John


John,

This is exactly what I want, but I forgot to include adding the username
(person who is modifying tab) to a cell below.

Thanks,
Ken


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com