+ Reply to Thread
Results 1 to 7 of 7

Delete range if met a string condition

  1. #1
    Registered User
    Join Date
    02-11-2015
    Location
    Amsterdam
    MS-Off Ver
    office 2007
    Posts
    39

    Delete range if met a string condition

    Hi,

    I have this beautiful code, founded on the net.

    I want to modify this code to not delete the entire row, but only the a range of row, for example range A1:C20.
    Where should I look if I wanted to change this code, or is there is any other solution, somewhere...? May be simpler?

    Please find attached an example... with the macro

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Delete range if met a string condition

    Change code as below:-
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Delete range if met a string condition

    You mean only Ax:Cx where X is rownumber where "apple" was found? or anyway entire A1:C20 if Apple is anywhere in it? or may be only these cells where Apple is?

    I assumed the first, so try:

    Please Login or Register  to view this content.
    Last edited by Kaper; 04-17-2015 at 10:34 AM.
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    02-11-2015
    Location
    Amsterdam
    MS-Off Ver
    office 2007
    Posts
    39

    Re: Delete range if met a string condition

    thanks MickG,

    We are getting closer... may be I was not clear to what I want it.
    Your solution works great, however I want also that the macro delete in that row a range for example A1:C20.

    With your solution, it only deletes that cell value. So what I want is that the delete shift up function should be applied for that row within the range of A to C --> because I have other data in Column D, E and F that not want to be moved or deleted...

    I hope I am clear

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Delete range if met a string condition

    Check out my proposition above - sounds it's exactly this case.

  6. #6
    Registered User
    Join Date
    02-11-2015
    Location
    Amsterdam
    MS-Off Ver
    office 2007
    Posts
    39

    Re: Delete range if met a string condition

    Whoops... I was too slow writing my reply to MickG.
    Kaper, gave me the solution I was looking for!!!

    Thanks everyone and wish everyone a great WEEKEND!!!

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Delete range if met a string condition

    Glad to hear that I helped again and thanks for reputation point and for marking thread solved.

    Have a great weekend too!

    MfG

    Kaper

+ 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. Replies: 7
    Last Post: 07-25-2014, 08:21 AM
  2. Need to use if condition using the string "
    By abduljaleel.mca in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2013, 09:09 AM
  3. Macro to delete specific range in a row with condition
    By abareesh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2013, 10:12 AM
  4. [SOLVED] count the number of times a string occurs in a range based on a condition
    By sshishirkumar in forum Excel General
    Replies: 6
    Last Post: 05-29-2012, 04:00 AM
  5. Replies: 6
    Last Post: 05-06-2010, 10:06 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