In my code $CoName won't always be perfect and will need adjusted slightly. $CoFixes fixes this issue. But when I run it as shown below, $CoName never makes it to $cell. I need to reuse the code in $CoFixes quite a few times so I'm trying to learn how to make this work.
$CoFixes = {
if ($CoName -eq "L.F. 10' Panel w/o lath"){$CoName = "L.F. of 10' Panel w/o lath"}
if ($CoName -eq "L.F. 9' Panel w/o lath"){$CoName = "L.F. of 9' Panel w/o lath"}
if ($CoName -eq "L.F. 8'2`" Panel w/o lath"){$CoName = "L.F. of 8'2`" Panel w/o lath"}
if ($CoName -eq "L.F. 4' Panel w/o lath"){$CoName = "L.F. of 4' Panel w/o lath"}
if ($CoName -eq "L.F. 4' Panel w/ 8`" top w/o lath"){$CoName = "L.F. of 4' Panel w/ 8`" top w/o lath"}
if ($CoName -eq 'Special Window Openings over 27"'){$CoName = 'Special Window Openings over 37"'}
if ($CoName -eq 'Door Opening up to 41.5" wide'){$CoName = 'Door Opening up to 41 1/2" wide'}
}
$CoName = $ChangeOrder1Worksheet.range('B20').text
&$CoFixes
$cell = $QuoteSheet.range('B1:B60').Find($CoName).offset(0, 3).address(0,0)
$value = $ChangeOrder1Worksheet.range('A20').text
&$vba
$objExcel.run("ChangeOrder", $cell, $value)
write-host $CoName " " $cell " " $value " " $QuoteSheet.range($cell).text