+ Reply to Thread
Results 1 to 5 of 5

Delete row if row contains word text (is surrounded by other text)

  1. #1
    Forum Contributor
    Join Date
    08-08-2015
    Location
    North Carolina USA
    MS-Off Ver
    MS Office 2016
    Posts
    368

    Delete row if row contains word text (is surrounded by other text)

    Hi, what would the code be to hide a row if the cell in column A contains the text "CEASEPHONE" .. an example of the text in the cell is 87543004937767149|AC|||CEASEPHONE||||| |05312016||||||05312016|

  2. #2
    Registered User
    Join Date
    11-01-2012
    Location
    Cairo, Egypt
    MS-Off Ver
    MS Office 2013
    Posts
    76

    Re: Delete row if row contains word text (is surrounded by other text)

    Any cell in column C contains the specified search string will result in deleting the entire row
    Hope this will help.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-08-2015
    Location
    North Carolina USA
    MS-Off Ver
    MS Office 2016
    Posts
    368

    Re: Delete row if row contains word text (is surrounded by other text)

    Awesome,thanks!

  4. #4
    Forum Contributor
    Join Date
    08-08-2015
    Location
    North Carolina USA
    MS-Off Ver
    MS Office 2016
    Posts
    368

    Re: Delete row if row contains word text (is surrounded by other text)

    What if I also wanted to highlight the cells (only columns A and B) before hiding?

    This didnt work..
    Sub CommandButton()
    Dim c As Range
    Dim SrchRng As Range
    Dim SrchStr As String
    Dim LR As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row
    Set SrchRng = ActiveSheet.Range("A2:A" & LR)
    SrchStr = "CEASEPHONE"
    Do
    Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
    If c Is Nothing Then
    c.Interior.ColorIndex = 8
    c.Offset(0, 1).Interior.ColorIndex = 8
    c.EntireRow.Hidden = True
    End If
    Loop While Not c Is Nothing

    End Sub

  5. #5
    Registered User
    Join Date
    11-01-2012
    Location
    Cairo, Egypt
    MS-Off Ver
    MS Office 2013
    Posts
    76

    Re: Delete row if row contains word text (is surrounded by other text)

    Use this instead:
    An Example is attached

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

+ 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. Pulling all data left of a certain word surrounded by spaces
    By excellerant8 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 10-26-2015, 01:48 PM
  2. Need to get stock symbols from a webpage directly
    By the duke in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2014, 04:36 PM
  3. [SOLVED] Delete all text in a cell until it gets to a word
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2012, 09:52 AM
  4. Delete text so it says everything except for a specific word
    By Tenmakk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-15-2012, 04:49 PM
  5. Can I delete text after a certain word?
    By Tenmakk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2012, 05:25 PM
  6. delete text from cell after a certain word
    By nervous_pilchard in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-21-2011, 11:28 AM
  7. Question - extracting a number surrounded by text
    By retimo in forum Excel General
    Replies: 2
    Last Post: 01-04-2008, 11:29 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