Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Record date workbook is first opened
I need help with writing a macro or formular that will record the firs date a workbook is open -- darke ----------------------------------------------------------------------- darkeh's Profile: http://www.excelforum.com/member.php...fo&userid=1534 View this thread: http://www.excelforum.com/showthread.php?threadid=26964 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Record date workbook is first opened
Private Sub Workbook_Open()
Dim rng as Range set rng = ThisWorkbook.Worksheets("Sheet1").Range("A1") if isempty(rng) then rng.Value = Date + Time rng.Numberformat:= "mm/dd/yyyy hh:mm:ss" rng.EntireColumn.Autofit End if end Sub Not sure what the situation is, but while this will write the date and time in the cell, the workbook must be saved as well. You might want to prompt for a path and filename at this time and save the file. Put a macro like the above in the ThisWorkbook Module. Chip Pearson's page on Events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "darkeh" wrote in message ... I need help with writing a macro or formular that will record the first date a workbook is open. -- darkeh ------------------------------------------------------------------------ darkeh's Profile: http://www.excelforum.com/member.php...o&userid=15340 View this thread: http://www.excelforum.com/showthread...hreadid=269641 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Record date workbook is first opened
An alternative is to put the value in a workbook name if you don't want to
show on a worksheet. -- HTH RP "Tom Ogilvy" wrote in message ... Private Sub Workbook_Open() Dim rng as Range set rng = ThisWorkbook.Worksheets("Sheet1").Range("A1") if isempty(rng) then rng.Value = Date + Time rng.Numberformat:= "mm/dd/yyyy hh:mm:ss" rng.EntireColumn.Autofit End if end Sub Not sure what the situation is, but while this will write the date and time in the cell, the workbook must be saved as well. You might want to prompt for a path and filename at this time and save the file. Put a macro like the above in the ThisWorkbook Module. Chip Pearson's page on Events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "darkeh" wrote in message ... I need help with writing a macro or formular that will record the first date a workbook is open. -- darkeh ------------------------------------------------------------------------ darkeh's Profile: http://www.excelforum.com/member.php...o&userid=15340 View this thread: http://www.excelforum.com/showthread...hreadid=269641 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to run a macro as soon a a workbook (.xls) is opened? | Excel Worksheet Functions | |||
Can macro/userform run depending on HOW workbook is opened? | Excel Discussion (Misc queries) | |||
Looking for a way to run a macro when the workbook is opened | Excel Programming | |||
Run a macro when a workbook is opened | Excel Programming | |||
Run a macro when a workbook is opened | Excel Programming |