+ Reply to Thread
Results 1 to 7 of 7

Macro to scan through sheets and delete data that matches value in cells

  1. #1
    Registered User
    Join Date
    09-26-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    42

    Macro to scan through sheets and delete data that matches value in cells

    Hi Guys,

    I have sheets called "Matt, Dion, Tamara, John" etc.

    And one sheet called "Master"

    Now What I would like to do is if column A in sheets "Matt, Dion, Tamara, John" matches a value in cell B1 in "Master" &
    if column G in sheets "Matt, Dion, Tamara, John" matches a value in cell B2 in "Master" then delete that entire row within sheets "Matt, Dion, Tamara, John".

    It must meet both criteria . If both criteria are not met then the row should not be deleted and should only be deleted if it matches both If statements.



    Any help is greatly appreciated.

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Macro to scan through sheets and delete data that matches value in cells

    Please Login or Register  to view this content.
    Frob first, tweak later

  3. #3
    Registered User
    Join Date
    09-26-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    42

    Re: Macro to scan through sheets and delete data that matches value in cells

    Thanks works a treat.

    Is there a way to enter a message box saying how many rows were deleted ? Also if no rows were deleted.

    Thanks

  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,283

    Re: Macro to scan through sheets and delete data that matches value in cells

    Try this.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 10-09-2016 at 08:24 PM.
    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
    Registered User
    Join Date
    09-26-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    42

    Re: Macro to scan through sheets and delete data that matches value in cells

    Saying no rows were found although the row is being deleted.

    I think its not counting correctly.

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

    Re: Macro to scan through sheets and delete data that matches value in cells

    Just made up example file and works perfectly fine for me.

  7. #7
    Registered User
    Join Date
    09-26-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    42

    Re: Macro to scan through sheets and delete data that matches value in cells

    Yep seems to be working.

    Unsure what I did wrong.

    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. [SOLVED] Need help- macro to scan all sheets for cells in date range, then copy rows to new sheet
    By BrenFred in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2016, 10:38 AM
  2. Comparing Data between sheets to find matches and no matches
    By tysont in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-26-2015, 03:07 PM
  3. [SOLVED] Tricky: Macro to compare cells of two sheets, no exact matches though
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2014, 08:19 AM
  4. Cross check data in two sheets and delete if it matches
    By EdwinNevis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2014, 06:59 AM
  5. [SOLVED] Macro to locate matches between data in two columns on two seperate sheets
    By bojangles_73 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-07-2012, 08:10 PM
  6. Scan through cells, and distribute to appropriate alpha sheets
    By jessegpierce in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-28-2011, 11:36 PM
  7. Scan through cells, and distribute to appropriate alpha sheets
    By jessegpierce in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2011, 07:37 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