+ Reply to Thread
Results 1 to 10 of 10

Entirerow.delete

  1. #1
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Entirerow.delete

    Hello,

    I have a question regarding the entirerow.delete function. For some reason I have to run the loop multiple times because in the first run through not
    not all rows to which the code applies are deleted.

    I had this on multiple different occasions that not all rows were deleted with the entirerow.delete method. I am wondering why this is and what my
    mistake may be?

    Any help is much appreciated.

    Kind Regards
    Prexcel

    Please Login or Register  to view this content.
    Last edited by Prexcel; 01-15-2014 at 05:26 PM.

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

    Re: Entirerow.delete

    No need for a while loop and for next loop with back ward looping will do the job.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Entirerow.delete

    Thank you,

    that works flawlessly!!!

  4. #4
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Entirerow.delete

    Can you explain why the code I was using was skipping rows?

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

    Re: Entirerow.delete

    It would be easy to solve it if you could attach a sample to see why the code skips rows.

  6. #6
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Entirerow.delete

    Hi,

    I attached a spreadsheet with a simillar macro that should delete the empty rows.
    I have to run this macro several times until all rows have been deleted. Strange!?
    Attached Files Attached Files

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

    Re: Entirerow.delete

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Entirerow.delete

    I get that for some reason it does work with Step -1. I lack to understand why it does not work with the other code.

    Both go row by row and evaluate the cell content and delete the row subsequently, right?

    Why is Step - 1 accurate and my code is not?

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

    Re: Entirerow.delete

    If you want to delete or insert a row in VBA, you should loop back ward (Step -1), not forward. If you do not, the code will skip a row as you delete them.

  10. #10
    Registered User
    Join Date
    11-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Entirerow.delete

    I understand now. Makes sense. I delete then the next row becomes the current row meanwhile the algorithm jumps to the next row thereby skipping the current row.
    Thanks for helping me out.

+ 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] Simple delete entirerow if value vba not working....
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2013, 05:10 AM
  2. CurrentRegion.EntireRow.Delete (+ the next row)
    By BBoydAnchor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-28-2011, 04:16 PM
  3. How to fix cell.entirerow.delete?
    By guy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 11:06 PM
  4. [SOLVED] EntireRow.Delete
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-21-2005, 07:06 PM
  5. EntireRow.Delete Not what I want
    By spencermjax in forum Excel General
    Replies: 1
    Last Post: 01-14-2005, 11:40 PM

Tags for this Thread

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