Hello,
I have a spreadsheet that has RTD (real time data) and I would like to create a macro that
when the values of column “B” with 1000 cells with RTD update their values, automatically record in the corresponding cells next to these values (column “A”) the hour, minutes, seconds and milliseconds.
And if any cell in column “B” is blank, leave the time cell blank.
I managed to make a macro, but it only works for a specific cell, I need the macro to work for a column with 1000 cells.
Private Sub Worksheet_Calculate()
If Range("B2").Value = "" Then
Range("A2").Value = ""
Else
Static oldval
If Range("B2").Value <> oldval Then
oldval = Range("B2").Value
Range("A2").Value = Application.WorksheetFunction.Text([now()] - tStart, "h:mm:ss.000")
End If
End If
End Sub
I have a spreadsheet that has RTD (real time data) and I would like to create a macro that
when the values of column “B” with 1000 cells with RTD update their values, automatically record in the corresponding cells next to these values (column “A”) the hour, minutes, seconds and milliseconds.
And if any cell in column “B” is blank, leave the time cell blank.
I managed to make a macro, but it only works for a specific cell, I need the macro to work for a column with 1000 cells.
Private Sub Worksheet_Calculate()
If Range("B2").Value = "" Then
Range("A2").Value = ""
Else
Static oldval
If Range("B2").Value <> oldval Then
oldval = Range("B2").Value
Range("A2").Value = Application.WorksheetFunction.Text([now()] - tStart, "h:mm:ss.000")
End If
End If
End Sub