Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a macro as soon a a workbook (.xls) is opened? Sangamesh Acharya Excel Worksheet Functions 1 December 15th 05 11:15 PM
Can macro/userform run depending on HOW workbook is opened? grasping@straws Excel Discussion (Misc queries) 1 December 28th 04 03:19 PM
Looking for a way to run a macro when the workbook is opened Bob Reynolds[_3_] Excel Programming 3 September 25th 04 02:58 PM
Run a macro when a workbook is opened Mervyn Thomas[_3_] Excel Programming 2 July 25th 03 11:40 AM
Run a macro when a workbook is opened Mervyn Thomas[_3_] Excel Programming 0 July 25th 03 11:18 AM


All times are GMT +1. The time now is 01:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"