Reputation: 2309
I am trying to create PowerShell that will highlight first 5 columns of the first row.
I tried this
$excel = New-Object -Com Excel.Application
$excel.Rows.Item("1:5").Interior.ColorIndex = 5
Among other variations in Item() and got strange output, i.e.
Thanks!
Upvotes: 1
Views: 46
Reputation: 32723
This should do it:
$excel = new-object -comobject Excel.Application
$excel.visible = $true
$workbook = $excel.workbooks.add()
$sheet = $workbook.ActiveSheet
$sheet.Range("A1:F1").interior.colorindex = 5
Upvotes: 2