Please help! Excel data logging question


Posted by Tom Lowe on June 29, 2000 3:28 PM

Here's what I have...

1 row (5-6 cells)of incoming linked data that updates every minute or so. So what I need is a macro or something that will log that data when then cell/row has changed. I'm sure its something simple for you Excel wizards but I am having the hardest time. Please help and any help is GREATLY appreciated.

Posted by Ivan Moala on July 01, 0100 12:45 AM

Tom / Ryan

I'm not 100% sure BUT, I think the DDE link
will not cause an application event to fire??
To get around this if it doesn't, just link
the cells linked to another range so that it will
change or cause an application event such as Calculate
to run.

Ivan

PS again I'm not sure, but I remember doing something
similar some time ago.

Posted by Tom Lowe on June 30, 0100 8:48 AM

Currently I have the values linked on sheet 1 all in row 3. So, I guess I need everything in row 3 copied to another sheet when the values are updated. You are a life saver.

Thanks,

Tom.

Posted by Ryan on June 30, 0100 2:53 PM

Tom,
I got it handeled. I copied my results on this page but i don't know how they are going to turn out so I'll explain it in words. From what you wrote I assumed that on Sheet1, Row 3, data was being automatically inputed. You said 5 or 6 columns worth. I have it set so that if the value in F3 changes, Sheet2 is updated with the date and time of change and the new data. I put in column headings on Sheet2 like this:
A = Date & Time B = Data1 C = Data2 and so on up to G = Data6. Sheet2 will only get updated if F3 on sheet1 is updated so is this is not the case let me know and I will look at it. The code that i'm giving you goes in the Microsoft Excel Objects folder and the Sheet1 module for the workbook. Like I said, if you need anymore help, let me know. Tell me how it works!
Ryan

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range
Dim LastRow As Integer
Set VRange = Range("F3")

Dim NewData As Range
Dim DataPage As Range
On Error Resume Next

Application.ScreenUpdating = False
LastRow = Sheets("Sheet2").Range("A65536").End(xlUp).Row

Set NewData = Sheets("Sheet2").Range("A" & LastRow + 1)

Set DataPage = Sheets("Sheet1").Range("A3")

If Union(Target, VRange).Address = VRange.Address Then
NewData.Value = Now()
NewData.Offset(0, 1).Value = DataPage.Value
NewData.Offset(0, 2).Value = DataPage.Offset(0, 1).Value
NewData.Offset(0, 3).Value = DataPage.Offset(0, 2).Value
NewData.Offset(0, 4).Value = DataPage.Offset(0, 3).Value
NewData.Offset(0, 5).Value = DataPage.Offset(0, 4).Value
NewData.Offset(0, 6).Value = DataPage.Offset(0, 5).Value

End If

Application.ScreenUpdating = True
End Sub


Date & Time Logged Data1 Data2 Data3 Data4 Data5 Data6

6/30/00 17:21 3 4 5 6 7
6/30/00 17:21 5 6 7 8 9
6/30/00 17:23 4 5 6 7 8
6/30/00 17:23 5 6 7 8 9



Posted by Ryan on June 29, 0100 5:37 PM

Tom,
How do you want it logged. Let me know that, and I'll have your answer lickity split!
Ryan