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!
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

pallav42

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

Watch MrExcel Video

Forum statistics

Threads
1,102,678
Messages
5,488,223
Members
407,632
Latest member
varunwalla

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top