Saving Info.

  • Thread starter Thread starter mathew
  • Start date Start date
M

mathew

Is there some way to save the information from a cell
periodically? I have one cell that changes in real-time,
and I would like to capture data from this cell
periodically so that I can chart it. I would appreciate
any help that might be provided.
 
You could setup a timed event in conjunction with a log file. Alternatively
you can capture the worksheet change event, check to see if the cell which
has changed is the one you're interested in and then act accordingly.
Don't recommend the 2nd option though due to the processing overhead.


The exact code is too much to list here but here are the key points.

Timed event
Application.OnTime Now + TimeSerial(0, 0, 30),"RoutineName"

Log file
Public Sub LogEvent(Description As String)
Dim n As Integer

' Operations such as log files should be extremelly transparent and
generally
' never report errors.
'
On Error GoTo errCantWrite

If Dir(LogFileDir, vbDirectory) = "" Then
MkDir LogFileDir
End If

' We're using the FreeFile function here instead of a simple Open #1
etc. because
' it's more robust. Consult the VBA help for a description.
'
n = FreeFile
Open LogFileDir & LogFile For Append As n
Print #n, Now & "," & Description
Close #n
Exit Sub

errCantWrite:
End Sub



http://www.billlunney.com/Excel/FAQ/DisplayFAQ.ascx?ExcelFAQID=99
http://www.billlunney.com/Excel/FAQ/DisplayFAQ.ascx?ExcelFAQID=109



--

Regards,


Bill Lunney
www.billlunney.com
 
Back
Top