Searching for a value in exel Merged cell?

Welcome Forums General PowerShell Q&A Searching for a value in exel Merged cell?

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 years, 3 months ago.

  • Author
    Posts
  • #18714

    Participant
    Points: 0
    Rank: Member

    I am trying to find a value in a merge cell. So can then start processing the cells below it. Setting a Range and then using the Find method could not find the value.

    thanks
    Jon

  • #18727

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    Sorry – we don't have a ton of people here who do Excel programming. In general, most of us try to avoid it like the plague because it's so complicated and time-consuming. Give me a SQL Server database any day!

  • #18730

    Participant
    Points: 0
    Rank: Member

    The excel spread is created by HR. I figure it out though. This is this a snippet. Also Get-filename is a function that open a windows so I can select the file. $excelsearchRange is how I was able to search for a value of a merge cell.
    pre

    $objExcel= new-object -comobject excel.application

    $objExcel.Visible=$false

    $filePath= Get-FileName "C:\Reports"

    write-host "Processing File $filepath"

    $arrayLHuser= New-Object System.Collections.ArrayList

    Write-Host "Opening Workook"

    $workbook= $objExcel.Workbooks.Open($filePath)

    $spreadsheet = $workbook.worksheets.item(1)

    $excelSearchString = "NAMES TO BE ADDED TO NOTIFICATION PROGRAM"

    (b)$excelSearchRange = $spreadsheet.range("A1").mergeArea(/b)

    $search = $excelSearchRange.find($excelSearchString)

    $intRow=$search.row+2
    /pre

The topic ‘Searching for a value in exel Merged cell?’ is closed to new replies.