+ Reply to Thread
Results 1 to 10 of 10

Doing an audit trail on multiple sheets

  1. #1
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Doing an audit trail on multiple sheets

    Hi all, I found the perfect macro that does an audit trail which reflects the username, the cells that has been changed and what are the changes made. However, when i added in more worksheets to the workbook, the audit trail does not apply to the rest. \

    Currently it only works on Sheet 1. I have a feeling that the changes to the code is only a minor amendment but can anyone take a look and let me know what i should add on or amend? Here's the codes for your reference. Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by Nett; 05-31-2010 at 02:43 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Doing an audit trail on multiple sheets

    I applied the code on two sheets and it seems running fine:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Doing an audit trail on multiple sheets

    Thanks sooo much! it works!=)

  4. #4
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Doing an audit trail on multiple sheets

    Hi again, sorry to resurface the problem again. but i tried the codes and it works well with multiple sheets now. But the only problem is that it does not capture the 'changed from'. For example when i open a new workbook, type in 'boy' on cell $A$1 and then changed it to 'girl' on the same cell, it reflects:

    User 1- sheet: Sheet1 - changed cell $A$1 from to boy
    User 1- sheet: Sheet1 - changed cell $A$1 from to girl

    With the previous code it captures the 'changed from' such as

    User 1 changed cell $A$1 from boy to girl

    Is omitting the code below the reason for this problem?
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Doing an audit trail on multiple sheets

    Excuse me but the code over is always necessary.
    You need to insert all this code in each sheet:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  6. #6
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Doing an audit trail on multiple sheets

    Hello Antonio,

    Thanks alot it works!=)

  7. #7
    Registered User
    Join Date
    10-03-2011
    Location
    Miami/Fort Lauderdale, Fl., USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Doing an audit trail on multiple sheets

    Dear Antonio and Nett,

    I am new to writing macros in Excel and Visual Basic. I tried using the macro below, but where will it display the change information? Will this work on all cells in a macro enabled workbook? Thanks in advance for your help.

    Best regards,
    Gene

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Value <> PreviousValue Then
    Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Value = _
    Application.UserName & " - sheet: " & ActiveSheet.Name _
    & " - changed cell " & Target.Address _
    & " from " & PreviousValue & " to " & Target.Value
    End If
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    PreviousValue = Target.Value
    End Sub

  8. #8
    Registered User
    Join Date
    10-01-2012
    Location
    Nashua new hampshire
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Doing an audit trail on multiple sheets

    I used the sub and it works but when I select multiple cells and change them I get a runtime error 13, type mismatch.
    How can this be avoided?

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Doing an audit trail on multiple sheets

    Mark Harrington,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Registered User
    Join Date
    02-05-2013
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Doing an audit trail on multiple sheets

    I hope this doesn't break any forum rules. I adapted this post for my uses and thought I'd add my version incase it's handy for anyone else.
    I've added a very simple error handler to prevent it complaining if a merged cell or multi cells are clicked on. I also split the log details up in to their own column to make it slightly easier to read (IMO). I also added a date/time stamp.
    Thanks to the author.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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