+ Reply to Thread
Results 1 to 4 of 4

remove row based on cell value, loop issue

  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    remove row based on cell value, loop issue

    Hello Excel Forum,

    In my range of E10-E1250, I need to find values lower than 0.9 and remove the entire row if found.
    Here's my simple loop that does the job most of the time:

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because your post count is low and the code is just a snippet. --6StringJazzer

    Please Login or Register  to view this content.
    The problem with it however is that after the row get's removed, the next row gets lifted up, and if the cell E in that row has the value of less than 0.9, it doesn't get removed because the loop moves on to the next row.
    So if i run this loop on the below range...
    E10 - 4.0
    E11 - 0.1
    E12 - 0.2
    E13 - 0.3
    E14 - 0.4
    E15 - 0.5
    E16 - 0.6
    E17 - 0.7
    E18 - 4.2

    i'm ending up with:
    E10 - 4.0
    E11 - 0.2
    E12 - 0.4
    E13 - 0.6
    E14 - 4.2

    and what i need is:
    E10 - 4.0
    E11 - 4.2

    How can i modify the exsisting loop so it gives me the desired result? Or, is there a better way to achive it perhaps? Would appreciate any help.
    Last edited by 6StringJazzer; 06-17-2014 at 01:36 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: remove row based on cell value, loop issue

    Work your way from the bottom up.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: remove row based on cell value, loop issue

    it works, that's a million

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: remove row based on cell value, loop issue

    You're welcome and thanks for the rep! If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

+ 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. Macro to Split and Remove based on cell value
    By karthik013 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-18-2014, 07:48 AM
  2. Move a Row to another Worksheet based on cell value (and remove row later)
    By spatel783 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2012, 01:51 PM
  3. Loop based on cell value
    By somesoldiers in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-04-2011, 11:29 AM
  4. remove row based on two cell contents
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2011, 08:10 AM
  5. Loop issue when cell value is null
    By starcraftbud in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-07-2009, 10:09 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