+ Reply to Thread
Results 1 to 3 of 3

Unable to delete rows

  1. #1
    Registered User
    Join Date
    05-22-2012
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    11

    Unable to delete rows

    The code below is meant to find an item that exists in one sheet, but not another. If this is the case, I want to cut and paste that row to another sheet, and then delete the empty row that is left behind. This is what I have currently:

    Please Login or Register  to view this content.
    When the code runs, however, I am left with a blank row in "UpdatedWS" that never got deleted.
    Where am I going wrong?

  2. #2
    Forum Contributor
    Join Date
    08-04-2011
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Unable to delete rows

    The problem could be that you are searching top-down. When you delete a row, it then messes up your loop iteration. If you work from the bottom row and work your way up, it won't interfere with your count cycle when deleting. Probably not a clear explaination, but when looping through rows and deleting, it is always best to work bottom-up.

  3. #3
    Registered User
    Join Date
    05-22-2012
    Location
    Lincoln, NE
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Unable to delete rows

    Right, since I am shifting up, each row below the deleted row moves up one number. Instead of deleting rows, I'm just re-filtering the sheet after rows are deleted, effectively shifting all empty rows to the bottom. It's working perfectly, so I think I can say this issue is resolved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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