vba help for 5 minutes data copy, store and auto stop
Results 1 to 2 of 2

Thread: vba help for 5 minutes data copy, store and auto stop
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Oct 2016
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default vba help for 5 minutes data copy, store and auto stop

    Hi there,
    In my worksheet prices update from trading terminal every minute for 27 stocks.
    sheet 1 named "bank" has 27 stocks where from F3 to F29 live prices of 27 different stocks are streaming and changing.

    Now what I need...
    1. After 3 minutes of market opening time 9.15 A.M, prices get copied and stored into cell K3 :K29 and auto stop.
    2. After 5 minutes of market opening time 9.15 A.M, prices get copied and stored into cell L3:L29 and stop.
    3.After 15 minutes of market opening time 9.15 A.M, prices get copied and stored into cell M3:M29 and stop.

    Please help and answer with vba code.

    Thank you!

  2. #2
    New Member
    Join Date
    Oct 2016
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: vba help for 5 minutes data copy, store and auto stop

    Well, with help of jbeaucaire's post I wrote macro of my need which is working perfectly..except one thing.
    I have to start and stop it manually through clicking starttimer and stoptimer button...sometimes it works and sometimes not..i don't know why? ..but from vba module it always works perfect.
    Can anyone help me out to find way of making it auto run and auto stop on specific time.?
    What to do to auto run macro at 9.15 and auto stop at 9.20?

    Option Explicit
    Public dTime As Date

    Sub ValueStore()
    Dim dTime As Date
    Range("J71:J142").Value = Range("D71:D142").Value
    Range("K71:K142").Value = Range("E71:E142").Value
    Range("L71:L142").Value = Range("F71:F142").Value
    Call StartTimer
    End Sub


    Sub StartTimer()
    dTime = Now + TimeValue("00:05:00")
    Application.OnTime dTime, "ValueStore", Schedule:=True
    End Sub

    Sub StopTimer()
    On Error Resume Next
    Application.OnTime dTime, "ValueStore", Schedule:=False
    End SubThank you, jbeaucaire for your post!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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