L
Legacy 98055
Guest
I created the following macro in Office 2000.
The user had no problem running it on his own computer using XP. However, on another computer at his workplace, he runs 97 and said it did not work. So I tried it on 97 and the following code gives the Death Sentence: "Excel has caused an error in<Unknown> Excel will now close. If you continue experiencing problem try restarting you computer"
Anyway, when I step through the following code it works fine and Excel 97 performs the same as 2000. Any one got a handle on this one?
Thanks,
Tom<pre>
Private Sub Worksheet_Calculate()
Dim NextRow As Long
Application.EnableEvents = False
If Range("A1")<> OldValueInA1 Then
If Range("B1")<> 0 Then
NextRow = Range("B1:B" & Range("B65536"). _
End(xlUp).Row).Rows.Count + 1
Else
NextRow = 1
End If
OldValueInA1 = Range("A1")
Range("B" & NextRow) = Format(Now, "DD-MM-YY HH:MM:SS")
If Range("A1") = 0 Then
If NextRow<> 1 Then
Range("C" & NextRow) = "Stopped"
Range("D" & NextRow) = "UP-Time"
Range("E" & NextRow) = Format(Now - Range("B" & _
NextRow - 1), "HH:MM:SS")
Else
Range("C" & NextRow) = "Stopped"
Range("D" & NextRow) = "Insuff. Data"
Range("E" & NextRow) = "N/A"
End If
Else
If NextRow<> 1 Then
Range("C" & NextRow) = "Started"
Range("D" & NextRow) = "DOWN-Time"
Range("E" & NextRow) = Format(Now - Range("B" & _
NextRow - 1), "HH:MM:SS")
Else
Range("C" & NextRow) = "Started"
Range("D" & NextRow) = "Insuff. Data"
Range("E" & NextRow) = "N/A"
End If
End If
End If
Application.EnableEvents = True
End Sub</pre>
This message was edited by TsTom on 2002-05-05 23:05
The user had no problem running it on his own computer using XP. However, on another computer at his workplace, he runs 97 and said it did not work. So I tried it on 97 and the following code gives the Death Sentence: "Excel has caused an error in<Unknown> Excel will now close. If you continue experiencing problem try restarting you computer"
Anyway, when I step through the following code it works fine and Excel 97 performs the same as 2000. Any one got a handle on this one?
Thanks,
Tom<pre>
Private Sub Worksheet_Calculate()
Dim NextRow As Long
Application.EnableEvents = False
If Range("A1")<> OldValueInA1 Then
If Range("B1")<> 0 Then
NextRow = Range("B1:B" & Range("B65536"). _
End(xlUp).Row).Rows.Count + 1
Else
NextRow = 1
End If
OldValueInA1 = Range("A1")
Range("B" & NextRow) = Format(Now, "DD-MM-YY HH:MM:SS")
If Range("A1") = 0 Then
If NextRow<> 1 Then
Range("C" & NextRow) = "Stopped"
Range("D" & NextRow) = "UP-Time"
Range("E" & NextRow) = Format(Now - Range("B" & _
NextRow - 1), "HH:MM:SS")
Else
Range("C" & NextRow) = "Stopped"
Range("D" & NextRow) = "Insuff. Data"
Range("E" & NextRow) = "N/A"
End If
Else
If NextRow<> 1 Then
Range("C" & NextRow) = "Started"
Range("D" & NextRow) = "DOWN-Time"
Range("E" & NextRow) = Format(Now - Range("B" & _
NextRow - 1), "HH:MM:SS")
Else
Range("C" & NextRow) = "Started"
Range("D" & NextRow) = "Insuff. Data"
Range("E" & NextRow) = "N/A"
End If
End If
End If
Application.EnableEvents = True
End Sub</pre>
This message was edited by TsTom on 2002-05-05 23:05