+ Reply to Thread
Results 1 to 6 of 6

Code to delete rows only works sometimes

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6

    Code to delete rows only works sometimes

    Dear all,

    I wrote the following code to copy a range of cells from one tab to another one (below a list) and delete a few rows based on the cell value of another column (and update a few pivots, hide a few rows in other tabs). The deleted rows are duplicates in the list on tab "RTC - Status en opvolging". I identify these duplicaties by using vlookup in the same range (which checks whether there is already the same ordernummer above the cells that have been pasted). If the value of this if(iserror(vlookup)-statement = 1, then the row should be deleted.

    This code worked fine in the beginning, but now it seems that it does not delete the rows anymore even though the value in column K=1. Can anybody help me and point me out what's wrong with the code?

    Thanks in advance,

    Bart

    Please Login or Register  to view this content.

  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: Code to delete rows only works sometimes

    All I can see is that you need to indicate a new line here:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    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

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Code to delete rows only works sometimes

    In the original code the lines are placed under each other, so I don't think this correction is necessary or am I wrong? I really can't figure out why it's not working anymore..If someone is willing to have a look at the original file, I will be glad to send it over.

    Thanks in advance!

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Code to delete rows only works sometimes

    Hi BartSeli,

    I tested this code:

    Please Login or Register  to view this content.
    and it ran like a charm!

  5. #5
    Registered User
    Join Date
    05-24-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Code to delete rows only works sometimes

    I can't figure it out either. Can it has something to do that the cell value of "1" is calculated in a table of excel 2010?

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Code to delete rows only works sometimes

    Have you single stepped through the code? I love the code by the way - did I rep you for that? - I intended to

+ 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. Changing code from deleting rows to cut/paste rows into another sheet and delete blank row
    By kmarshall6576 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2013, 01:54 AM
  2. my code delete all the rows
    By suny100 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2011, 02:35 PM
  3. Code to delete rows based on status code in Column I
    By LemonTwist in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2009, 07:01 PM
  4. Code to delete all rows that have 0
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2007, 02:25 PM
  5. Code to delete rows
    By shanemjo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2005, 02:36 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