Play with this
Application.OnTime Now + TimeValue("00:0:05"), "MyMacroInModule"
DT +++
>________________________________
> From: Dr John C Bullas <john.bullas@gmail.com>
>To: ExcelVBA@yahoogroups.com
>Sent: Tuesday, 16 July 2013, 12:10
>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> 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@yahoogroups.com] On
>> Behalf Of Dr John C Bullas
>> Sent: Monday, July 15, 2013 2:46 PM
>> To: excelvba@yahoogroups.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]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (4) |
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