Insert time in another column when a column containing RTD updates values

dsenff

New Member
Joined
Oct 24, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
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
 

Attachments

  • RTD2.PNG
    RTD2.PNG
    28.6 KB · Views: 18

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Insert time in another column when a column containing RTD updates values
and here Insert time in another column when a column containing RTD updates values
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Last edited:
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Insert time in another column when a column containing RTD updates values
and here Insert time in another column when a column containing RTD updates values
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.


Ok, very sorry for the cross-posting.
Won't happen again.
 
Upvote 0
Can you please supply links to any other site where you have asked this question, as requested.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top