Question: Add-ConditionalFormatting - Using column name instead of Excel coordinates?
Is there a way to use the column name instead of using the Excel coordinates?
Example:
Add-ConditionalFormatting -Address $WorkSheet.Cells["P:P"] -WorkSheet $WorkSheet -RuleType 'Expression' 'NOT(ISERROR(FIND("Keyword",$P1)))' -BackgroundColor Red
When I add an additional column or when the order of the columns changed the conditional formatting is broken. I would prefer working with the column names like directly in PowerShell.
Thank you!
Good question. Don't know.
Export-Excel has -AutoNameRange and I use that so I can then do New-ExcelChartDefinition -XRange Region -YRange Units and avoid row/col addressing.
I believe Add-ConditionalFormatting should handle named ranges.
Create one, give it a try, let me know.