+ Reply to Thread
Results 1 to 3 of 3

Auto record cell data

Hybrid View

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    26

    Auto record cell data

    Anybody able to help me with this issue I am having. I have posted some code below which I am using to automatically record a cells data and stamp data in another cell.

    Sub ValueStore()
    Dim dTime As Date
       Worksheets("Data Capture").Range("A" & Cells(Rows.Count).Row).End(xlUp).Offset(1, 0).Value = Worksheets("Match Odds").Range("H9").Value
      
        Call StartTimer
    End Sub
    
    
    Sub StartTimer()
        dTime = Now + TimeValue("00:10:00")
        Application.OnTime dTime, "ValueStore", Schedule:=True
    End Sub
    
    Sub StopTimer()
        On Error Resume Next
        Application.OnTime dTime, "ValueStore", Schedule:=False
    End Sub
    The time is set to record the data every 10 minutes but this can be changed via the clock on the Sub StartTimer. I have a cell on the excel sheet on which I use this code which is linked to an external source and has a 24hr clock countdown to an event starting.

    What I am trying to do is when the cell with the countdown reaches 1 hour untill the event start it automatically changes from recording the data every 10 minutes to every 1 second. Thank you taking the time to look at this for me...

    Gally


    Mod's Note: code tags added for you this time
    Last edited by FDibbins; 11-01-2012 at 06:38 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Auto record cell data

    Try something like this. Change the sheet name and cell reference to the cell that has your countdown clock.

    Sub StartTimer()
        If Sheets("Sheet1").Range("A1").Value <= TimeValue("01:00:00") Then
            dTime = Now + TimeValue("00:00:01")
        Else
            dTime = Now + TimeValue("00:10:00")
        End If
        Application.OnTime dTime, "ValueStore", Schedule:=True
    End Sub

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,972

    Re: Auto record cell data

    gally...

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1