+ Reply to Thread
Results 1 to 2 of 2

Modifying a Macro that Tracks Changes

Hybrid View

leooclaws Modifying a Macro that Tracks... 09-09-2014, 12:12 PM
Fotis1991 Re: Modifying a Macro that... 09-09-2014, 12:19 PM
  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Modifying a Macro that Tracks Changes

    I would like to modify a macro that I am using to track changes in a workbook, but do not know the best way to go about it. The macro that I am using is listed below.
    As of right now, the changes tracker is giving me the name of the active worksheet and the cell number that was changed. The problem with that is, if I add or delete any rows, it is hard to go back and trace which row was changed. So, what I wanted to do was modify the macro so that in the cell changed column it would still add the active worksheet, the cell that was changed, and the column F that corresponds to the row.

    I am trying to track changes made for bank accounts. So, all of the account numbers are always in column F. So Ideally, if I changed one of the signers from John Doe to Kevin Doe, the value that would show up on the changes tracker worksheet would be, “US Accounts: $H:$7:123456489”
    A B C D E F G H
    BRANCH BANK NAME ADDRESS COUNTRY ACCOUNT NAME ACCOUNT # CURRENCY SIGNERS
    505 Citibank California USA Bank Account 1 123456489 USD John Doe Jane Doe



    Does anyone know of a way to modify this so that I could get that information? Or, if anyone has a different macro that might work. Thanks in advance for any help!

    Here is the macro that I am currently using:

    Option Explicit
    
    Dim vOldVal 'Must be at top of module
    
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    
    Dim bBold As Boolean
    
    
    If Target.Cells.Count > 1 Then Exit Sub
    If ActiveSheet.Name = "Pricing" 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 Sheets("Changes Tracker")
                '.Unprotect Password:="Secret"
                    If .Range("A1") = vbNullString Then
                        .Range("A1:H1") = Array("Cell Changed", "Old Value", _
                            "New Value", "Old Formula", "New Formula", "Time of Change", "Date of Change", "User")
                    End If
    
                With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
                      .Value = ActiveSheet.Name & " : " & Target.Address
                      .Offset(0, 1) = vOldVal
                With .Offset(0, 2)
                  If bBold = True Then
                    .ClearComments
                    .AddComment.Text Text:= _
                         "OzGrid.com:" & Chr(10) & "" & Chr(10) & _
                            "Bold values are the results of formulas"
    
                  End If
                    .Value = Target
                    .Font.Bold = bBold
                    
                End With
                    .Offset(0, 3) = Time
                    .Offset(0, 4) = Date
                    .Offset(0, 5) = 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
    
    
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
        vOldVal = Target
    End Sub
    
    Private Sub test()
        Application.EnableEvents = True
    End Sub
    Last edited by leooclaws; 09-09-2014 at 03:41 PM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Modifying a Macro that Tracks Changes

    Welcome to the forum. Pls take some minutes to read forum rules because(in this case):

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    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



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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. Add user-based color functionality to macro that tracks changes
    By jmalankar in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-03-2010, 04:46 PM
  2. Modifying Macro
    By hanyou.lin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2008, 06:32 AM
  3. Modifying Macro
    By CLR in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 07:05 PM
  4. Modifying Macro
    By CLR in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 11:05 AM
  5. Modifying Macro
    By carl in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10: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