+ Reply to Thread
Results 1 to 11 of 11

VBA to validate data & highlight differences

  1. #1
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    VBA to validate data & highlight differences

    Morning,

    I have some data split as previous months data & current months data, what i need to do is;

    - Validate both sets of data against each other to make sure the references we have from previous month we have on current month
    - Any references that are not on current month but are on previous month need to be highlighted on differences sheet with a source id
    - Any references that are on current month but are not on previous month need to be highlighted on differences sheet with a source id
    - The references for validation are column B (Asset ID Code)

    I have attached my workbook for example.

    Regards
    Attached Files Attached Files
    Last edited by kenadams378; 02-19-2013 at 06:53 AM.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: VBA to validate data & highlight differences

    Please try routine 'ReportDifferences' in the attached workbook
    Attached Files Attached Files
    If you like my contribution click the star icon!

  3. #3
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to validate data & highlight differences

    Wow, thank you.

    Is it possbile to make a change to this and pull through the whole line of data on the differences sheet?

  4. #4
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: VBA to validate data & highlight differences

    as in the source data from the original sheet?

  5. #5
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to validate data & highlight differences

    Yep, the whole line of data from the source sheet.

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: VBA to validate data & highlight differences

    OK. Here it is
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to validate data & highlight differences

    Brilliant, spot on!

    Thank you so much...

  8. #8
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to validate data & highlight differences

    I have worked with this code for a few days now and wondered if it would be possible, on the differences sheet to highlight the cell that is the difference between the data?

  9. #9
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: VBA to validate data & highlight differences

    Ken, that does not make sense.

    We are only checking whether all asset codes mentioned on the previous month worksheet are present on the current month worksheet and vice versa. If missing on either worksheet we are reporting the entire row of the source worksheet on the differences worksheet. Which cell do you want to highlight?

  10. #10
    Forum Contributor
    Join Date
    05-01-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    822

    Re: VBA to validate data & highlight differences

    My apologies, i confused myself.

    I forgot we used the asset ID as the identifier to highlight any differences.

    Many thanks for your reply

  11. #11
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: VBA to validate data & highlight differences

    No problems.

    We could add a comparison of columns as well for those asset codes that exist on both worksheets, and if one or more differences are found add the row to the differences worksheet, and highlight the columns that are different. Should not be too difficult.

+ 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