+ Reply to Thread
Results 1 to 4 of 4

Trying to delete some rows if conditions met or do nothing if not met

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016
    Posts
    33

    Trying to delete some rows if conditions met or do nothing if not met

    I am trying to make a tracking for people on plans, with weekly follow ups. Each weekly follow up is recorded as a separate line entry, so they can be displayed in a box as a filtered list. This part works great.

    Once someone gets finished with their plan, I mark "exited" in a few of places on two worksheets. The one is the master list of who is on a plan, and the second is on the list of weekly followups. Each of their entries gets the "exited" mark. This part also works great.

    Where I am running into problem is when the time comes to actually remove the ones with the "exited" mark to clean up my list. I found a code that does what I was looking for, and modified it to do the deleting part based on the presence of "exited". The problem comes if no one says "Exited" of course. Unfortunately, I do not understand the code that I stole enough to fix it.

    So the question is, how can I make this do absolutely nothing if no columns say "Exited", except perhaps a msgBox to say "all clear"

    Any help would be appreciated, and I apologize in advance for my inept follow-up questions.

    BobR

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    06-09-2011
    Location
    Germany
    MS-Off Ver
    Excel 2016
    Posts
    194

    Re: Trying to delete some rows if conditions met or do nothing if not met

    Hi BobR,

    you could use the on error command as shown below. I have also changed the message box to allow responding to the question.
    Please Login or Register  to view this content.
    Let me know if this works for you.

    Theo
    Remember To Do the Following....
    1. Upload sample files
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Trying to delete some rows if conditions met or do nothing if not met

    Hi,

    you can always check if rng1 and rng2 is not nothing, and only then proceed (in red) (untested):
    Please Login or Register  to view this content.
    Hope this helps.

    Rgs,
    berlan

  4. #4
    Registered User
    Join Date
    08-16-2012
    Location
    Florida
    MS-Off Ver
    Excel 2016
    Posts
    33

    Re: Trying to delete some rows if conditions met or do nothing if not met

    Thank you Theo and Berlan. I am going to sleep on this tonight, and will look at them tomorrow after I am rested. They are both certainly more elegant than what I was thinking.

    I figured if nothing else, I could add "Exited" below the bottom row at the top of the subroutine, so that there was something to find.

    Thank you both!

    BobR

+ 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. How to delete rows subject to 2 conditions ?
    By sami770 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2013, 11:11 AM
  2. Delete Rows Based on Two Conditions
    By ExcelGuy160 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-20-2010, 02:44 PM
  3. Delete rows that don't meet certain conditions
    By bubulac in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-08-2010, 06:43 PM
  4. Delete rows, multiple conditions
    By rm7302 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-22-2009, 08:28 AM
  5. Delete rows with conditions
    By mridzuani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2008, 02:52 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