'How do I search for a string of names in an Excel spreadsheet and then color the cell if it matches in Powershell?

Current code is:

    $SearchString = "P1", "P2", "P3", "P4", "P5", "P6"

$Range = $ws.Range("B1").EntireColumn
$Search = $Range.find($SearchString)

if ($Search -match $Programs ){
    $Search.cell.Interior.ColorIndex = 10
    }

$Programs = "P1", "P2", "P3", "P4", "P5", "P6"

Thanks for any help or insight!

-J



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source