+ Reply to Thread
Results 1 to 4 of 4

Search a Range for a phrase and Format cell if found

  1. #1

    Search a Range for a phrase and Format cell if found

    Hi
    I've got a spread sheet containing spec's for vehicles, I want to search
    them to highlight specific items by changing the cell color

    Here's an example of the sheet, this is one column with each line in a cell.

    (BYRAB) PROGRAMMABLE DRIVER SEAT
    (CBLAE) 315 MHZ DOOR LOCK FREQUENCY
    (CFKAA) LESS HEADLAMP CLEANING
    (CBSAC) SINGLE LOCKING PWR LOCK LATCH
    (DAQAA) LESS BLOCK HEATER RECEPTACLE

    I need to highlight any that have "LESS" ,there are 77 columns vehicle of
    data by 100 rows

    would be gratefully for any help

    Kev

  2. #2
    RB Smissaert
    Guest

    Re: Search a Range for a phrase and Format cell if found

    This is one way of doing it:

    Sub test()

    Dim arr
    Dim r As Long
    Dim c As Long

    arr = Range(Cells(1), Cells(100, 77))

    For r = 1 To 100
    For c = 1 To 77
    If InStr(1, _
    arr(r, c), _
    " LESS ", _
    vbBinaryCompare) > 0 Then
    Cells(r, c).Interior.ColorIndex = 27
    End If
    Next
    Next

    End Sub


    RBS

    <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    > I've got a spread sheet containing spec's for vehicles, I want to search
    > them to highlight specific items by changing the cell color
    >
    > Here's an example of the sheet, this is one column with each line in a
    > cell.
    >
    > (BYRAB) PROGRAMMABLE DRIVER SEAT
    > (CBLAE) 315 MHZ DOOR LOCK FREQUENCY
    > (CFKAA) LESS HEADLAMP CLEANING
    > (CBSAC) SINGLE LOCKING PWR LOCK LATCH
    > (DAQAA) LESS BLOCK HEATER RECEPTACLE
    >
    > I need to highlight any that have "LESS" ,there are 77 columns vehicle of
    > data by 100 rows
    >
    > would be gratefully for any help
    >
    > Kev



  3. #3

    Re: Search a Range for a phrase and Format cell if found

    Thanks for the quick reply that worked a treat.

    Kev

  4. #4
    Bob Phillips
    Guest

    Re: Search a Range for a phrase and Format cell if found

    Why not use conditional formatting.

    Select all the cells and test for a value of LESS, and select a pattern
    colour.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    > I've got a spread sheet containing spec's for vehicles, I want to search
    > them to highlight specific items by changing the cell color
    >
    > Here's an example of the sheet, this is one column with each line in a

    cell.
    >
    > (BYRAB) PROGRAMMABLE DRIVER SEAT
    > (CBLAE) 315 MHZ DOOR LOCK FREQUENCY
    > (CFKAA) LESS HEADLAMP CLEANING
    > (CBSAC) SINGLE LOCKING PWR LOCK LATCH
    > (DAQAA) LESS BLOCK HEATER RECEPTACLE
    >
    > I need to highlight any that have "LESS" ,there are 77 columns vehicle of
    > data by 100 rows
    >
    > would be gratefully for any help
    >
    > Kev




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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