+ Reply to Thread
Results 1 to 12 of 12

new to vba ...need to compare 2 spreadsheets

  1. #1
    Registered User
    Join Date
    12-02-2013
    Location
    charlotte, nc
    MS-Off Ver
    Excel 2010
    Posts
    4

    new to vba ...need to compare 2 spreadsheets

    I know very little VBA (very adept in SQL) and I am hoping someone could assist me so I can learn from this initial effort.
    I want to compare two spreadsheets with the same column order and naming convention. However, I want to highlight the differences in the base spreadsheet (Sheet1) that only has a subset of data of the other sheet (Sheet2). There is a primary key (Column A) in both spreadsheets.
    Desired workflow:
    IF Colum A id Sheet 1 is in Column A Sheet2, then compare each adjacent column for differences.
    Example: If Sheet1!Column A1 id = Sheet2!A9 id, then compare Sheet1!B1 to Sheet2!B9, so and so on.
    Highlight the differences on Sheet1
    Also, I have some disparate values for some columns that should be treated as matches.
    For Example column C in both Sheets need to be equal when the following occurs
    Sheet1!column C value is “NEW” and Sheet2!columnC value is “Pipeline” they should be a match
    Any help with this is greatly appreciated and will serve as a basis for me in the future.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-25-2016
    Location
    charlotte
    MS-Off Ver
    2010
    Posts
    6

    Re: new to vba ...need to compare 2 spreadsheets

    hi ...here is the attachment
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    I put them in different sheets - do that and try:

    Please Login or Register  to view this content.
    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    *Be sure to save the book with the code as Macro-Enabled

  5. #5
    Registered User
    Join Date
    04-25-2016
    Location
    charlotte
    MS-Off Ver
    2010
    Posts
    6

    Re: new to vba ...need to compare 2 spreadsheets

    Absolutely awesome!! Now I can start learning!! thank you.

    thank you again
    Last edited by mlttlk; 04-27-2016 at 10:01 AM.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Registered User
    Join Date
    04-25-2016
    Location
    charlotte
    MS-Off Ver
    2010
    Posts
    6

    Re: new to vba ...need to compare 2 spreadsheets

    yes it does take care of my question...thanks again. However, once I select Thread Tools there are only 3 choices, none of which allow me to mark it as SOLVED.

    the choices are:

    Show Printable page
    Email the page
    Subscribe to this thread

    am I missing something?

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    Well - you've got two different handles - see if it works on post#1

  9. #9
    Registered User
    Join Date
    04-25-2016
    Location
    charlotte
    MS-Off Ver
    2010
    Posts
    6

    Re: new to vba ...need to compare 2 spreadsheets

    hey ...I have a problem I discovered that I can't solve yet. I have created web connections that refresh the data in both sheet1 and sheet2. Once I added the connections the macro no longer works. any ideas?

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    Does it throw an error?

  11. #11
    Registered User
    Join Date
    04-25-2016
    Location
    charlotte
    MS-Off Ver
    2010
    Posts
    6

    Re: new to vba ...need to compare 2 spreadsheets

    Oh crap ...user error!!!!!!!

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: new to vba ...need to compare 2 spreadsheets

    I've got to go to work now - let me know how it resolves.

+ 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. Compare 2 spreadsheets ?
    By ItalianGuy in forum Excel General
    Replies: 2
    Last Post: 05-16-2017, 02:32 AM
  2. [SOLVED] Compare two spreadsheets
    By EmilyFerrier in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-01-2014, 04:37 PM
  3. Compare 2 spreadsheets
    By MatzN in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-22-2013, 07:03 AM
  4. Compare Spreadsheets
    By westie1871 in forum Excel General
    Replies: 3
    Last Post: 04-11-2011, 10:23 AM
  5. Compare 2 spreadsheets?
    By kdr in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 04-14-2010, 09:30 AM
  6. Excel 2007 : compare two spreadsheets in
    By ekoot in forum Excel General
    Replies: 1
    Last Post: 02-08-2010, 07:46 AM
  7. Compare spreadsheets
    By ianma in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2008, 12:27 PM
  8. Compare Two Spreadsheets
    By Ty in forum Excel General
    Replies: 1
    Last Post: 02-15-2006, 01:15 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