Probably this will help you to record.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LR = ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
'd = workbookfunction.Today()
n = Now()
ThisWorkbook.Worksheets(1).Cells(LR, 4).Value = n
'ThisWorkbook.Worksheets(1).Cells(LR + 1, 3).Value = n
End Sub
Private Sub Workbook_Open()
Dim d As Date
LR = ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
'd = workbookfunction.Today()
n = Now()
ThisWorkbook.Worksheets(1).Cells(LR + 1, 1).Value =
ThisWorkbook.Worksheets(1).Cells(LR, 1).Value + 1
ThisWorkbook.Worksheets(1).Cells(LR + 1, 3).Value = n
End Sub
On Wed, Jul 17, 2013 at 10:09 AM, Tim Lewis <tlewis@innovativecg.com> wrote:
> **
>
>
> Would it be acceptible for it to save the time using the BeforeClose
> subroutine?
>
> From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On
> Behalf Of Dr John C Bullas
> Sent: Tuesday, July 16, 2013 4:11 AM
> To: ExcelVBA@yahoogroups.com
> Subject: Re: [ExcelVBA] A simple uptime logging worksheet?
>
> Hi!
>
> I want to hit a button that writes the value of NOW
>
> then writes the value of now() to another cell every minute
>
> then saves the file
>
> ( the values in these 2 cells are not volatile so reopening the save fill
> will preserve the start and last saved times )
>
> clearer?
>
> John
>
> On 16 July 2013 06:31, Tim Lewis <tlewis@innovativecg.com<mailto:
> tlewis%40innovativecg.com>> wrote:
>
> > John,
> > I am not sure that I understand the question, but based on what I
> > interpret the question to be, this will do it:
> >
> > Add a command button ( Developer -> Insert -> select "Command Button"
> > under "ActiveX Controls")
> >
> > Private Sub CommandButton1_Click()
> > Range("A1").FormulaR1C1 = Now
> > Call WaitFor(5) 'for a delay of a minute
> > Range("A2").FormulaR1C1 = Now
> > ThisWorkbook.Save
> > Call WaitFor(5) 'for a delay of a minute
> > Range("A2").FormulaR1C1 = Now
> > ThisWorkbook.Save
> > End Sub
> >
> > Sub WaitFor(NumOfSeconds As Long)
> > Dim SngSec As Long
> > SngSec = Timer + NumOfSeconds
> > Do While Timer < SngSec
> > DoEvents
> > Loop
> > End Sub
> >
> >
> > Tim
> >
> >
> > From: ExcelVBA@yahoogroups.com<mailto:ExcelVBA%40yahoogroups.com>
> [mailto:ExcelVBA@yahoogroups.com<mailto:ExcelVBA%40yahoogroups.com>] On
> > Behalf Of Dr John C Bullas
> > Sent: Monday, July 15, 2013 2:46 PM
> > To: excelvba@yahoogroups.com<mailto:excelvba%40yahoogroups.com>
> > Subject: [ExcelVBA] A simple uptime logging worksheet?
> >
> >
> >
> > Good afternoon,
> >
> > I am a newby as regards VB, I know what I want to achieve but I have no
> > real idea how to go about it. I want to leave a worksheet open that will
> > autosave to keep a record of the current time and when it was opened,
> thus
> > the uptime is recorded.....
> >
> > =================
> >
> > Sub WaitFor(NumOfSeconds As Long)
> > Dim SngSec as Long
> > SngSec=Timer + NumOfSeconds
> >
> > Do while timer < sngsec
> > DoEvents
> > Loop
> >
> > End sub
> >
> > =============
> >
> > Called up by
> >
> > Call WaitFor()
> >
> > i.e Call Waitfor(60) for a delay of a minute
> >
> > ====
> >
> > I want to have a worksheet with a GO button that copies the value of
> NOW()
> > into A1 and then waits for a minute copies the value of NOW() into A2
> then
> > saves the worksheet then waits for a minute then repeats the write of
> NOW()
> > to A2 and saves again
> >
> > When this falls over I will have the uptime and the start and end times
> for
> > the period
> >
> > Is this difficult to code?
> >
> > --
> >
> > ===========================
> > http://uk.linkedin.com/in/drjohnbullas
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > ----------------------------------
> > Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
> > here: http://www.mousetrax.com/techtrax to enter the ezine, then search
> > the ARCHIVES for EXCEL VBA.
> >
> > ----------------------------------
> > Visit our ExcelVBA group home page for more info and support files:
> > http://groups.yahoo.com/group/ExcelVBA
> >
> > ----------------------------------
> > More free tutorials and resources available at:
> > http://www.mousetrax.com
> >
> > ----------------------------------Yahoo! Groups Links
> >
> >
> >
> >
>
> --
>
> ===========================
> http://uk.linkedin.com/in/drjohnbullas
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
>
>
--
Regards,
Mayank Shah
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (7) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar