+ Reply to Thread
Results 1 to 9 of 9

VBA delete the entire line if the cell equal to 0

  1. #1
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    VBA delete the entire line if the cell equal to 0

    Hi, I want to compare 2 workbooks (sheet 1 of "Compare EF" and wb2), the result will display in sheet 2 of wb "compare EF". The problem is that I want to delete the entire rows in the result if the value of column E equal to 0. It should look like that instead of the result already have in the "Differences" sheet:

    Using Excel 2007
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    2 Missing order in Lomax 19/07/2016
    3
    4 There is no difference
    5
    6 Missing order in EFS 19/07/2016
    7 LU05137410 19/05/2016 24/05/2016 Unit 9 Abs
    8 LU08126074 19/05/2016 24/05/2016 Unit 612.75 Abs
    9 LU08126096 19/05/2016 24/05/2016 Unit 8.5 Abs
    10 LU08324354 18/05/2016 19/05/2016 Unit 6300 Lyx
    Sheet: Differences


    Could someone help me plz?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    Re: VBA delete the entire line if the cell equal to 0

    I write this code in the sub "Find differences" (rem 14) but it doesn't work:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA delete the entire line if the cell equal to 0

    You need to loop back wards if you want to delete rows. Filter is much more efficient.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    Re: VBA delete the entire line if the cell equal to 0

    Thank you, I tried your code but it didn't work...

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA delete the entire line if the cell equal to 0

    It worked on the attached sample.

  6. #6
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    Re: VBA delete the entire line if the cell equal to 0

    Actually it reversed the orders in the result sheet

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA delete the entire line if the cell equal to 0

    The code works on the reference sheet as you can see from the attached. Your naming of sheets is very unusual and will lead to error
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    Re: VBA delete the entire line if the cell equal to 0

    It is because it will show the differences between 2 wb (Missing order 1 and Missing order 2), so if it delete rows backwards, it will also delete the title Missing order 2 so the 2 result will be mixed and aren't clears.

    I only need to loop in the first part (Missing order 1) and indicate "There is no difference" if all rows in the first "Missing order.." are deleted, so I don't know if looping backwards is efficace
    Last edited by shinpencil; 07-20-2016 at 04:55 AM.

  9. #9
    Registered User
    Join Date
    04-07-2016
    Location
    Paris, France
    MS-Off Ver
    MS Office 2010
    Posts
    68

    Re: VBA delete the entire line if the cell equal to 0

    Post deleted
    Last edited by shinpencil; 07-20-2016 at 05:12 AM.

+ 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. VBA code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  2. Macro code to delete entire row if cell in column A is equal to a value
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2014, 02:54 PM
  3. Delete Row if equal to Cell
    By Dnass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2013, 01:13 AM
  4. [SOLVED] Delete cell only with certain critria. Don't want to delete entire row, the celsl only
    By RobertOHare in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 04:18 AM
  5. Macro to delete entire rows where O2:O does not equal a date
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2011, 10:37 PM
  6. Delete Entire Row When Cell Not Equal
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2009, 02:23 AM
  7. [SOLVED] I want cell A1 to equal $A$2 even after inserting line at A2
    By adamb2000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-28-2006, 07:25 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