Results 1 to 2 of 2

Thread: How to change text to red if value in cell changes and add last updated on date to the row
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Oct 2009
    Location
    Houston, Texas
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default How to change text to red if value in cell changes and add last updated on date to the row

    I need to change the cell text format to RED if the value of the cell is changed (not formatting or just clicking in it). Additionall, when the cell is changed in a row, a column at the end needs to show the date last changed (mm/dd/yyyy) and name of computer that changedit.

    Is this accomplished with conditional formatting or VBA?

    How do you do it?

    Thanks!

  2. #2
    Board Regular
    Join Date
    Aug 2009
    Location
    Southern Finland
    Posts
    1,521
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to change text to red if value in cell changes and add last updated on date to the row

    Paste the following to the worksheet module:
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim CN As String
    
    
    With Application
        .EnableEvents = False   'if this was left true the macro would trigger itself
        .ScreenUpdating = False
    End With
    
    
    CN = Environ("computername")  'Environ("username") would return the current user name
    
    
    If Target.Cells.Count > 1 Then  'Remove or comment these rows if it doesn't matter how many cells are changed at the same time
        GoTo TheEnd 'Jumps to the end without making the changes
    End If
    
    
        With Target
            .Font.ColorIndex = 3
    '        Intersect(.EntireRow, Range("Z:Z")).Value = Format(Date, "mm/dd/yyyy") & " " & CN   'Always the same column
            Cells(.Row, Columns.Count).End(xlToLeft).Offset(, 1).Value = Format(Date, "mm/dd/yyyy") & " " & CN  'Alwasy the last column
        End With
    
    
    
    
    TheEnd:
    
    
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
    
    
    End Sub

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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