Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Finding high/low values of a field which is updating every second

0

I want to find high and low values of A1 field which is updating every second (importing values from a trading platform).  Is it possible to make a line chart with this updaing values. 

Answer
Discuss

Discussion

Is the data already being saved to the spreadsheet somewhere? And, is that saved data what you want to use to make the chart?
don (rep: 1989) Oct 4, '16 at 6:46 pm
The data is not saving.  The data is the trading price of a particular share which is changing every second.  
das (rep: 2) Oct 5, '16 at 2:36 am
What is updating cell A1 right now? Do you have a macro that does this? Because then you can just add a few lines of code to that existing macro to save the data and then the chart can probably be created using some simple dynamic formulas.
don (rep: 1989) Oct 7, '16 at 2:58 pm
Thank you for responding.  I am getting data from an online trading software.  The macro showing is =RTD("nest.scriprtd",,"nse_fo|NIFTY16OCT8800PE","LTP") .  Here Nest is the trading platform of Nifty (Indian stock exchange) and LTP is the last trading price..  i need the high/low of this LTP or the line chart.     
das (rep: 2) Oct 8, '16 at 1:02 am
Add to Discussion

Answers

0
Selected Answer

Based on your question, you need to have a macro that runs every second (which is not great by the way because it can "freeze" the rest of Excel if you want to use it).

Use this macro as the template for running every second:

Sub timer_copy_data()

    interval = Now + TimeValue("00:00:01")

    'Code to run every second
    Cells(Range("A" & Rows.Count).End(xlUp).Row + 1, 1).Value = Cells(1, 1).Value

    Application.OnTime interval, "timer_copy_data"

End Sub

This should copy the data into the next empty row in column A every second once you start the macro.

Update

For the chart, follow this tutorial (one of ours) to make a dynamic chart.

Discuss
0

Thank you Mr. Don,  This iis exactly what I want.  I changed the time to every 20 seconds and plotting a line chart.Thanks a lot.

Das

Kerala

India

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login