خرید بک لینک

Vote count: 0

I have a PowerShell script that searches an Excel file for a specific value ("#N/A", from a failed VLOOKUP) that needs to have all of the rows AFTER and including that row deleted quickly.

What I have done so far:

                    $sheetRange = $sheetData.UsedRange
                    $colRange = $sheetData.Range("F1")
                    [void] $sheetRange.Sort($colRange)
                    $fileWorking.Save()

                    $strFinder = "#N/A"
                    $gSearch = $sheetData.Range("F1").EntireColumn
                    $txtFound = $gSearch.Find($strFinder)
                    $RowFound = ($txtFound.Row)
                    for (($i = $RowFound); ($i -le $rowsTrans); $i++)
                    {
                        $currRow = $sheetData.Cells.Item($i).EntireRow
                        [void]$currRow.Delete()
                    }
                    $fileWorking.Save()

The problem is, there are over 200k rows, and I need to delete the entire range instead of one row at a time. While I have muddled around with the syntax some, I can't quite figure out the proper syntax or methods that accomplish this.

Obviously, the for loop simply needs to go, and I need to set the entire range between $RowFound and $rowsTrans... but how is that done?

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 20 فروردين 1395 ساعت: 3:47

صفحه بندی