View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default build a list with timestamps

I got an e-mail this afternoon indicating there was a new posting, yet when I
looked there is no message.

"Joel" wrote:

I made 3 changes

1) Added Date to MyTime when saving data to worksheet
.Range("A" & NewRow) = MyTime + Date

Date is the midnight time and Mytime is only the hours, minutes and seconds.

2) Changed Start time to 9:30. For testing I was using 6:30 and forgot to
change the time before posting
3) I changed the end time to <4:01PM so the 4:00PM time gets posted.
Otherwise the last posting would be 3:59PM.


Note:
You can add a workbook open event to automactically start the macro. Put
this code in the Thisworkbook VBA sheet.

Private Sub Workbook_Open()
Call GetData
End Sub



Sub GetData()

'Ideally I don't want it to activate the workbook since I want to be
'working in other applications or other workbooks while it runs


If MyTime = TimeValue("9:30AM") And _
MyTime < TimeValue("4:01PM") Then

With ThisWorkbook
Range("SumDaily").Copy
'Application.CutCopyMode = False
With .Sheets("Sheet3")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
.Range("B" & NewRow).PasteSpecial _
Paste:=xlPasteValues, _
Transpose:=True
.Range("A" & NewRow) = MyTime + Date
End With
End With
End If
Application.OnTime Now + TimeValue("00:01:00"), "GetData"

End Sub

" wrote:

Works great!!! Thanks.

One question...the time stamp includes a date (1/0/1900), depending on
how I format it. Is there a way to include today's date with the
time?

Thank you
Steve