+ Reply to Thread
Results 1 to 2 of 2

tracking changes to formula results

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    tracking changes to formula results

    Good Morning All,

    I am looking to track changes to a specific section of cells, after doing some digging i've found and modified the code below that in general terms works but I am having a couple of problems tha tI can't yet solve.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range)
    Dim bBold As Boolean
    
    If N = 0 Then Exit Sub
    'If target.Cells.Count > 1 Then Exit Sub
    If Intersect(target, ActiveSheet.Range("RL32:RR140")) Is Nothing Then Exit Sub
    On Error Resume Next
    
        With Application
             .ScreenUpdating = False
             .EnableEvents = False
        End With
    
        If IsEmpty(vOldVal) Then vOldVal = "Empty Cell"
        bBold = target.HasFormula
            With Sheet2
                .Unprotect Password:="Secret"
                    If .Range("A1") = vbNullString Then
                        .Range("A1:G1") = Array("SHEET CHANGED", "CELL CHANGED", "OLD VALUE", _
                            "NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE", "USERNAME")
                    End If
                 
                With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
                      .Value = ActiveSheet.Name
                      .Offset(0, 1) = target.Address
                      .Offset(0, 2) = vOldVal
                          With .Offset(0, 3)
                            If bBold = True Then
                              .ClearComments
                              .AddComment.Text "Logged:" & Chr(10) & "" & Chr(10) & _
                                      "Bold values are the results of formulas"
                            End If
                              .Value = target
                              .Font.Bold = bBold
                          End With
                  
                    .Offset(0, 4) = Time
                    .Offset(0, 5) = Date
                    .Offset(0, 6) = Application.UserName
                End With
    
                .Cells.Columns.AutoFit
    
                .Protect Password:="Secret"
    
            End With
    
        vOldVal = vbNullString
    
    
    
        With Application
    
             .ScreenUpdating = True
    
             .EnableEvents = True
    
        End With
    
    
    
    On Error GoTo 0
    End Sub
    1. The range "RL32:RR140" are all the results of a formula and code above will track changes to the cells that drive these results but not the result itself (that lies within the above range) - how can the code be modified to look at the results of the formula?

    2. Column RK contains names of agents that I would like to be flagged in the log sheet, I can create the column entry within the log sheet but am at a loss at how I can for example after identifying a change to the formula result in cell RR48, get the value within RJ48.

    Any Help will be appreciated, in the meantime i'll be heading back to Google.

  2. #2
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: tracking changes to formula results

    please close/delete this! for some reason my posts aren't showing up in my recent posts and I couldn't remember if I had raised this (got distracted with something), so I have posted twice now. The other post now also have an example workbook.

+ 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: 14
    Last Post: 06-27-2012, 04:26 PM
  2. Tracking test results over time - new field needed?
    By JP Romano in forum Access Tables & Databases
    Replies: 6
    Last Post: 03-11-2011, 05:55 PM
  3. Replies: 19
    Last Post: 03-02-2011, 10:16 PM
  4. Tracking changes to formula results in cells
    By dinkybluebug in forum Excel General
    Replies: 1
    Last Post: 02-11-2010, 07:14 AM
  5. Replies: 1
    Last Post: 03-23-2005, 10:06 AM

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