methuselah
methuselah

Reputation: 13216

Get Powershell to search for blank cells from referenced row and not search the whole column

I would like to to search for blank cells in an Excel spreadsheet from a referenced row ($startRow) but instead Powershell searches the whole column (it starts at row 1).

How can I get it to start explicitly from $startRow.

$startRow = 3
$pointer = $sh.cells.item($startRow,2).EntireColumn.find("").Address()
$pointer

Upvotes: 0

Views: 1564

Answers (1)

Eris
Eris

Reputation: 7638

Given that $sh.cells is most likely a collection, I suggest this:

# If cells is actually a dictionary/hashtable:
#$sh.cells.GetEnumerator() | 
# if cells is an array:
$sh.cells | 
    Select -Skip $startRow |
    ForEach-Object {
        $_.EntireColumn.find("").Address()
    }

Upvotes: 1

Related Questions