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

pallav42

New Member
Joined
Oct 7, 2016
Messages
2
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!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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?

Code:
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 Sub
Code:

Thank you, jbeaucaire for your post!
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top