+ Reply to Thread
Results 1 to 7 of 7

Audit Trail Not Working 100% As Planned

  1. #1
    Registered User
    Join Date
    04-12-2019
    Location
    Boston, MA
    MS-Off Ver
    2016
    Posts
    6

    Audit Trail Not Working 100% As Planned

    Hello,

    I'm new to VBA and I have some code for an audit trail I've found on the web that I'd like to make work for my project.

    The goal is to have 5 columns of data, on another worksheet titled "Audit", as follows: Username of who made the change, Cell change location, Previous Data, New Data (overwritten or added new), Date/Time of Change.
    What is currently happening is I seem to only be tracking changes that happen in column A of my primary worksheet. It does track Username, cell location, new data, and date/time of change. But it doesn't pick up what the previous data was and I am stumped on that part. I've tried changing certain lines to different ranges and I'm not seeing any changes in what it prints out.

    Here is my code just for the Audit Trail portion:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Audit Trail Not Working 100% As Planned

    .
    Create a sheet named "Tracker". Paste this code in the ThisWorkbook module :

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-12-2019
    Location
    Boston, MA
    MS-Off Ver
    2016
    Posts
    6

    Re: Audit Trail Not Working 100% As Planned

    Hi Logit,

    I plugged in your code but it isn't working at all on my "Audit" sheet. I'm new to VBA so I may not be understanding everything that is going on in your code. For example, I looked up .HasFormula but I'm not sure its necessary to have in my sheet since I'm mostly dealing with data entry and not formulas (save a couple of cells).

    Here is all of my code with yours plugged in at the bottom (attached). If you have time could you please explain what I'm doing wrong? I'd like to learn from my mistakes too so I can do this by myself in the future.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-12-2019
    Location
    Boston, MA
    MS-Off Ver
    2016
    Posts
    6

    Re: Audit Trail Not Working 100% As Planned

    Hi Logit,

    I accidentally added your code to Sheet1 instead of ThisWorkbook. Once I added it to ThisWorkbook, it mostly works; however I think I'm missing some data in my audit tracker.

    This is what I get as an output when I make changes in sheet 1:

    VBA_01.PNG

    It seems that everything is switched around. I'm going to make some changes and see if I can fix it.
    Last edited by cferretti; 04-17-2019 at 11:34 AM. Reason: Code actually didn't work as planned.

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Audit Trail Not Working 100% As Planned

    .
    My apologies. After posting the code I realized some of it was "out of wack". I edited the code in my workbook but failed to
    repost the correct code for your use. I am so sorry.

    Here is the correct code :

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-12-2019
    Location
    Boston, MA
    MS-Off Ver
    2016
    Posts
    6

    Re: Audit Trail Not Working 100% As Planned

    Thank you, Logit!

    I actually made some changes too once I figured out how everything works. Thank you for your code, it works great!

    Here is my version, the only difference is the order of the columns:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Audit Trail Not Working 100% As Planned

    .
    You are welcome.

+ 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. VBA Audit trail not working
    By BSAGAERT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2017, 11:27 AM
  2. Audit Trail
    By thong127 in forum Excel General
    Replies: 2
    Last Post: 04-26-2017, 09:38 AM
  3. [SOLVED] Audit Trail with VBA!
    By Keibri in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2016, 04:11 AM
  4. Audit Trail
    By Moggzzz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2016, 06:48 AM
  5. Audit Trail
    By jenziepie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2013, 01:56 PM
  6. Track Changes - Audit Trail
    By ChemistB in forum Excel General
    Replies: 2
    Last Post: 10-27-2006, 02:16 PM
  7. Audit Trail
    By Pendelfin in forum Excel General
    Replies: 1
    Last Post: 01-23-2006, 11:10 AM

Tags for this Thread

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