ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   History for Realtime measurement (https://www.excelbanter.com/excel-discussion-misc-queries/90696-history-realtime-measurement.html)

David_J

History for Realtime measurement
 

Hello all,

I have a question about copying a value from one cell to another row.

I'm having realtime measurement coming into excel from a flowmeter.
The connection is made with DDE.

All is going well but I have only one cell that gets an update every
second or so. Value in the cell is between 0.0000 and 2.0000 and
depends on the flow in the flowmeter.
I want to store the information from that realtimecell to the next row
to be able to create a graph.

How do I copy (automatic) that cell to a row so I can have some history
from that realtime measurement?


--
David_J
------------------------------------------------------------------------
David_J's Profile: http://www.excelforum.com/member.php...o&userid=34827
View this thread: http://www.excelforum.com/showthread...hreadid=545792


mrice

History for Realtime measurement
 

I would suggest a macro linked to the worksheet_change event

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then
Cells(65536, 3).End(xlUp).Offset(1, 0) = Target
End If
End Sub

assuming that the cell that is changing is A1


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=545792


David_J

History for Realtime measurement
 

Thanks mrice,

It works very good.

Now it copy's the A1 cell everytime it changes to B1 then B2 then B...
Is it possible to assing a time to the copy action?
Like every 10 seconds one copy (1 minute would result in B1 B6)
This would be better to create a graph because the time is known.
A test runs could last for 14 hours with a flow (A1) that changes
constant.
The result now is a lot of data...

It would be even better if it was possible to change the time (one copy
every 10 sec or one every minute) in another cell (C1?).

Thanks,

David.


--
David_J
------------------------------------------------------------------------
David_J's Profile: http://www.excelforum.com/member.php...o&userid=34827
View this thread: http://www.excelforum.com/showthread...hreadid=545792


mrice

History for Realtime measurement
 

Try this

Public RunWhen As Double

Sub Capture()
Cells(1, 1).Copy Destination:=Cells(65536, 2).End(xlUp).Offset(1,
0)
RunWhen = Now + TimeSerial(0, 0, Cells(1, 3))
Application.OnTime RunWhen, "Capture", , True
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=545792


David_J

History for Realtime measurement
 

mrice,

Perfect!
It works like a dream.
Thanks!!!!

Gr, David.


--
David_J
------------------------------------------------------------------------
David_J's Profile: http://www.excelforum.com/member.php...o&userid=34827
View this thread: http://www.excelforum.com/showthread...hreadid=545792



All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com