+ Reply to Thread
Results 1 to 4 of 4

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

  1. #1
    Registered User
    Join Date
    12-30-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    1

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

    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

    RTD2.PNG

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,467

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

    You should use Worksheet Change rather than Calculate.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

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

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

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

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    I have added the link since this is your first post. However, since you have broken two rules in your first post, please take the time to review our rules. There aren't many, and they are all important.

    Cross-posted at https://www.mrexcel.com/board/thread...alues.1185619/
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2021, 04:58 AM
  2. Need to Show Updates highlighted based on values in Column A
    By meredith.k.shearer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2020, 02:25 AM
  3. Replies: 3
    Last Post: 02-14-2016, 07:56 AM
  4. If column A values don't match insert column else do the following
    By lsantanafkaa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2014, 10:48 AM
  5. vba UPDATES VALUES THROGUH COLUMN VALUES TO MASTER SHEET FROM CLOSED WORKBOOK
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2013, 09:47 PM
  6. [SOLVED] Compare 4 column values then insert a 5th columns value to a blank column/cell value
    By JasonKMcCoy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2012, 06:01 PM
  7. Insert Date & Time to a neightbouring column when I double click in column A
    By contaminated in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2011, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1