+ Reply to Thread
Results 1 to 10 of 10

Macro to delete rows if any cell contains specific content

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    9

    Macro to delete rows if any cell contains specific content

    I need a macro that will delete all rows that contains any cells in a string of text, containing this content:

    http://www.fanbox.com/PremiumBlogs/M...nts.aspx?coach
    http://profile.fanbox.com/Mail/MessageHistory.aspx?with
    http://blogs.fanbox.com/PBlogPostMod...spx?ClientUser

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Macro to delete rows if any cell contains specific content

    Looks like the common text in all the 3 rows is fanbox.com. Is this the only content that needs to be checked or is there a list of such content?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Macro to delete rows if any cell contains specific content

    There is a list of links and content, but I need to isolate these three are specific phrases in the string of texts and delete the rows they are on.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to delete rows if any cell contains specific content

    1) Create a sheet called STRINGS and put those search strings into column A starting at A1, goign down.

    2) This macro will search the ACTIVESHEET for every string in that list and delete those rows

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    05-25-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Macro to delete rows if any cell contains specific content

    For some reason, the macro isn't really doing anything. It only deleted one row at a time, not all the rows at once.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to delete rows if any cell contains specific content

    Post a sample workbook so I can see your whole scenario. Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

  7. #7
    Registered User
    Join Date
    05-25-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Macro to delete rows if any cell contains specific content

    File is attached. I just need a macro to delete the excess lines containing certain words/content in a string of text.
    Attached Files Attached Files

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to delete rows if any cell contains specific content

    Hm, odd. try this:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-25-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Macro to delete rows if any cell contains specific content

    Thank you! That completely worked!

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to delete rows if any cell contains specific content

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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