+ Reply to Thread
Results 1 to 3 of 3

need code to record values every 5 seconds

  1. #1
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    need code to record values every 5 seconds

    I have a spreadsheet that receives stock and option quotes in real-time via RTD ("real time data") links provided in an Excel Add-in. The quotes are then used in other calculations that constantly change throughout market trading hours. I need code that will test a given cell every five seconds and record a new value only when a new max or min has been reached. Note: I am a rank beginner at VBA.

  2. #2
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: need code to record values every 5 seconds

    Could this work?


    Insert in a new module
    Please Login or Register  to view this content.
    Insert in ThisWorkbook

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-05-2013
    Location
    Oklahoma City, Oklahoma
    MS-Off Ver
    Excel for Mac 2024
    Posts
    142

    Re: need code to record values every 5 seconds

    Thank you for your response! I need more than that, so let me explain further.

    The value in Cell B1 is fed by an RTD link and changes every few seconds. Cell B2 contains the uppermost value that the RTD link in B1 has generated ever since the code has been running. Every five seconds I need for the code to test whether B1 > B2. If so, then change B2 = B1. If not, then B2 does not change. I do not need to save the workbook each time the code loops but rather merely change the value in B2.

+ 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