Results 1 to 10 of 10

Thread: Highlight Cells That Contain Specific Text or Keyword

  1. #1
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14

    Highlight Cells That Contain Specific Text or Keyword

    I have a spreadsheet, where I need sort, extract or highlight the text where the word Cash appears in Col H

    If the data containing the text "Cash" cannot be sorted together, then I would like a macro to extract the data based on this criteria. The extracted data must be extracted to a seperate sheet containing Cols B to H. The other alternative is to highlight the data in Col H where cash appears in Col H

    Your assistance in resolving this is most appreciated

    Sortting using Custom
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    Code:
    Sub a()
    LR = Cells(Rows.Count, "H").End(xlUp).Row
    For j = 1 To LR
      If InStr(Cells(j, "H").Text, "Cash") > 0 Then
        Cells(j, "H").Interior.ColorIndex = 6
      End If
    Next
    End Sub

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    Please try this as well.

    Navigate to Conditional formatting > New rule > Use a formula to determine which cells to format > Paste this function & highlight with your desired color.
    =ISNUMBER(SEARCH("Cash",H2))

  4. #4
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Hi Guys

    Thanks for the help, much appredciated

  5. #5
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Hi Patel

    Thanks for the help, much appreciated.

    Your code works perfvectly on the uploaded file. Hower, when trying to run it on another workbook, it did not work-see attached sample

    Kindly check and amend your code accordingly

    Regards

    Howard
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    Code:
    Option Compare Text
    
    Sub a()
    LR = Cells(Rows.Count, "H").End(xlUp).Row
    For j = 1 To LR
      If InStr(Cells(j, "H").Text, "Cash") > 0 Then
        Cells(j, "H").Interior.ColorIndex = 6
      End If
    Next
    End Sub

  7. #7
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Hi Patel

    Thanks for the help. Macro works perfectly

    Regards

    Howard

  8. #8
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Hi Patel

    It would be appreciated if you could amend your code to highlight the text cash where the value is 25000 and over. The values are in Col G. I have tried to amend but cannot get it to work


    Option Compare Text

    Sub a()
    LR = Cells(Rows.Count, "H").End(xlUp).Row
    For j = 1 To LR
    If InStr(Cells(j, "H").Text, "Cash") > 0 And Cells(j, "G").Value >= 25000 Then
    Cells(j, "H").Interior.ColorIndex = 6
    End If
    Next
    End Sub

  9. #9
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    your change seems correct, it works on your attached file
    Last edited by patel; 07-21-2013 at 05:07 PM.

  10. #10
    Senior Member
    Join Date
    Apr 2012
    Posts
    193
    Rep Power
    14
    Hi Patel

    My apologies. The additional code that I added i working. I forot to clear the highliighted items before running the code

    I have now added cose to first clear the highlighted items


    Regards

    Howard

Similar Threads

  1. Find All Empty Blank Cells Or KeyWord In A Column
    By william516 in forum Excel Help
    Replies: 9
    Last Post: 06-25-2013, 05:20 PM
  2. Replies: 6
    Last Post: 06-01-2013, 03:24 PM
  3. Find keyword using multiple Text box and combox value
    By Ryan_Bernal in forum Excel Help
    Replies: 2
    Last Post: 03-07-2013, 06:11 PM
  4. Replies: 7
    Last Post: 06-23-2012, 07:56 PM
  5. Replies: 0
    Last Post: 02-27-2012, 01:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •