+ Reply to Thread
Results 1 to 11 of 11

Delete rows in Sheet A if any conditions found in Sheet B met

  1. #1
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Delete rows in Sheet A if any conditions found in Sheet B met

    Hi All experts,

    I am trying to write a macro where it will delete rows in Sheet A if any condition is found in the row which is based of conditions in Sheet B.

    Eg

    Sheet A :

    Column A Column B Column C Column D
    1234 ABC tyu 4588
    asd qwe www 4455
    zxc zdaa 1234 4441
    ghj llll 1111 poo0

    (And many more....)

    Sheet B (where i kept my conditions in Column A: )

    Column A
    1234
    1111
    (and many more....)

    So for this instant , the end results will be the Row 1 and row 4 will be deleted. I have tried to google but most only contains deleting rows with a specific conditions.

    Any 1 can help me please ?

    Thanks,

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Hello,

    Why wouldn't row 3 be deleted? It contains 1234 in column C?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Hi Sweep,

    Thanks for your time in reading this. Yes it should be deleted too .

    Thanks again!

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    This should work for you.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Thanks Sweep !

    It seems that i have to clicked numerous times before the related rows get deleted and also I noticed that it only delete the row if the condition is found in Column A in Sheet A ?

    We are getting there , really appreciate your help

    Thanks

  6. #6
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Also, somehow i also encountered this error Run time error '424': Object required while repeating the macro .

  7. #7
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    hmm,

    not my experience - could you please post a copy of the workbook you're using?

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    hi Anselmcai, option, press Run button on Sheet1
    Attached Files Attached Files
    Last edited by watersev; 07-03-2014 at 07:06 AM. Reason: Code updated

  9. #9
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Thanks Sweep and watersev for trying to help.

    I realized something wrong with my request and actually what i wanted to achieve is in Sheet A , there will be multiple Headers ( A to I ) and the line after the headers will have a sub heading. What i need is actually a macro to look under sub header BOOK and see whether any of it matches the condition in B.

    The sub header book is different in each Main header and the number of lines for each heading varies.

    Attached is the worksheet. Able to help mates ?

    Thanks
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    option, please check attachment, run code "test"
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Delete rows in Sheet A if any conditions found in Sheet B met

    Thanks alot for your help watersev !

    Excellent , its working perfectly now!

    Cheers!

+ 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. Lookup Value from Sheet 4 in Sheet 2, if found copy Sheet 2 Active Row to Sheet 5
    By lgosso23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-11-2013, 02:51 PM
  2. [SOLVED] Copy row from sheet 1 to next row in sheet 2. delete from sheet 1 and move rows up
    By papabob1954 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-16-2012, 09:38 PM
  3. [SOLVED] Delet Rows in sheet 1 incase data not found in another sheet
    By pavittersingh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2012, 10:48 PM
  4. Replies: 1
    Last Post: 07-15-2012, 08:52 AM
  5. Filter records, paste into a different sheet, delete rows from original sheet.
    By gloworm1973 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2009, 05:24 AM

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