+ Reply to Thread
Results 1 to 2 of 2

Comparing cells in different workbooks and deleting rows in which the cells match

  1. #1
    Registered User
    Join Date
    07-24-2018
    Location
    Tampa, Fl
    MS-Off Ver
    Office 365
    Posts
    7

    Comparing cells in different workbooks and deleting rows in which the cells match

    Forgive me if the answer to this is in a different thread, but I have been searching and have been unable to find what I am looking for.

    What I am trying to do is compare the results of a scan that are in a workbook to a list of items to disregard based on the contents of a cell in each workbook and if they match then delete that row. If I were to try to write it out in "pseudocode" I believe it would be something like this:

    If ([current workbook][sheet1][cellF2] = [path to workbook 2][sheet1][Any Cell in Column B]), then delete [current workbook][sheet1][row 2]
    Do this for all rows

    current workbook = scan results
    Workbook 2 = findings to disregard

    Once I have the code that would accomplish this, I would like to put it in a macro that would check all rows in the scan results workbook. So the process would be something like this:

    If workbook 1.sheet 1.F2 =workbook 2.sheet 1.any cell in column B, delete row 2, If no match do nothing and move to next row
    If workbook 1.sheet 1.F3 =workbook 2.sheet 1.any cell in column B, delete row 3, If no match do nothing and move to next row
    If workbook 1.sheet 1.F4 =workbook 2.sheet 1.any cell in column B, delete row 4, If no match do nothing and move to next row
    If workbook 1.sheet 1.F5 =workbook 2.sheet 1.any cell in column B, delete row 5, If no match do nothing and move to next row
    If workbook 1.sheet 1.F6 =workbook 2.sheet 1.any cell in column B, delete row 6, If no match do nothing and move to next row
    If workbook 1.sheet 1.F7 =workbook 2.sheet 1.any cell in column B, delete row 7, If no match do nothing and move to next row
    etc, etc.

    Any help will be greatly appreciated.
    I am very green when it comes to vba so please be gentle!
    Last edited by slider7420; 07-24-2018 at 10:31 AM.

  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: Comparing cells in different workbooks and deleting rows in which the cells match

    Attach a sample workbook (not a picture or pasted copy). 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.
    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

+ 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. [SOLVED] Create multiple workbooks from a template with deleting rows that don't match criteri
    By john_matta in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-29-2016, 10:14 PM
  2. Comparing two cells and deleting if it matches...
    By vrzy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2015, 08:05 AM
  3. Replies: 0
    Last Post: 02-11-2015, 12:57 PM
  4. Comparing 2 cells from different workbooks and copying if same
    By Erenagh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-22-2011, 03:49 PM
  5. Comparing cells in workbooks
    By Short Coco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 10:50 PM
  6. [SOLVED] Deleting entire rows when several cells match
    By Steve in forum Excel General
    Replies: 2
    Last Post: 12-01-2005, 07:35 PM
  7. [SOLVED] Comparing Cells in Workbooks
    By Carlton Patterson in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-23-2005, 09: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