ImportExcel icon indicating copy to clipboard operation
ImportExcel copied to clipboard

Question: Add-ConditionalFormatting - Using column name instead of Excel coordinates?

Open evild3ad opened this issue 6 months ago • 1 comments

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!

evild3ad avatar Jul 01 '25 10:07 evild3ad

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.

dfinke avatar Jul 01 '25 13:07 dfinke