+ Reply to Thread
Results 1 to 6 of 6

Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sheet1

  1. #1
    Registered User
    Join Date
    02-23-2020
    Location
    Oldham, England
    MS-Off Ver
    O365
    Posts
    9

    Unhappy Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sheet1

    Hi all, I am new to this forum and very new to VBA! I am trying to help my wife with a spreadsheet she uses a lot. Basically I need to find a row in sheet 1 (Tracking) where Column B is the same in both and where column G in sheet 2 (BL) matches column D in sheet 1, and if so, update the data in sheet 1 column E with the data from sheet 2 column H. And then highlight any rows in sheet 2 which did not match....

    Now thanks to some code that I found on the Internet I have managed to do most of this but I cannot figure out how to do the second comparison, sheet 2 column G to sheet 1 column D. Can anyone help?? It would be greatly appreciated. My code for the bit that doesn't work is below:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by theeachi; 02-23-2020 at 05:00 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sh

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then 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

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

    By the way, you could attach a short Excel sample to help for debugging
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    02-23-2020
    Location
    Oldham, England
    MS-Off Ver
    O365
    Posts
    9

    Re: Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sh

    Hi, thank you for the welcome and the feedback. I have done has requested.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,366

    Re: Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sh

    Does this work for you.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sh

    Quote Originally Posted by theeachi View Post
    Basically I need to find a row in sheet 1 (Tracking) where Column B is the same in both and where column G in sheet 2 (BL) matches column D in sheet 1, and if so, update the data in sheet 1 column E with the data from sheet 2 column H. And then highlight any rows in sheet 2 which did not match....
    Try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-23-2020
    Location
    Oldham, England
    MS-Off Ver
    O365
    Posts
    9

    Re: Trying to compare two non adjacent columns in sheet2 to two non adjacent columns in sh

    These work great, thank you very much , i am not 100% sure what they are doing though. Is it possible to add comments? No worries if not, thanks again.

+ 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. Replies: 9
    Last Post: 12-03-2016, 12:49 PM
  2. [SOLVED] Compare cells in adjacent columns
    By sam99 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-22-2013, 05:45 AM
  3. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  6. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. [SOLVED] compare contents of two adjacent columns
    By Adam in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-08-2005, 05: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