Powershell add 1 to excel column reference -


just asked powershell question here finding excel cell reference , need add it.

the overall code ended follows.

$filepath = "c:\temp\test.xlsx"  if (test-path $filepath) { $wb = $xl.workbooks.open($filepath) $ws = $wb.worksheets.item("sheet1") if ([bool]$ws.cells.find("german           baseload")) {write-host $ws.cells.find("german           baseload").address(0, 0, 1, 0)} } 

this returns cell reference of f25 string located, based on want test cell next in cell reference g25, question how add 1 column f25?

accessing cell known cell reference matter of applying range.offset property original cell reference.

$filepath = "t:\tmp\findit.xlsx" $xl = new-object -comobject excel.application $xl.visible = $true if (test-path $filepath) { $wb = $xl.workbooks.open($filepath) $ws = $xl.worksheets.item("sheet1") if ([bool]$ws.cells.find("german"))      {     $found = 1     $rc1 = $ws.cells.find("german")     $rc2 = $rc1.offset(0, 1)     write-host $found     write-host $rc1.address(0, 0, 1, 1)     write-host $rc2.address(0, 0, 1, 1)     write-host $ws.cells.find("german").offset(0, 1).address(0, 0, 1, 1)     } } 

i've reported offset cell address redundantly way of confirmation.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -