1 Replies - 271 Views - Last Post: 08 October 2013 - 12:47 PM Rate Topic: -----

#1 jeansymolanza  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 77
  • Joined: 20-February 08

Powershell - Get the cell location (e.g. B32) after running search

Posted 06 October 2013 - 01:17 PM

How would you get the the cell location of a value once you have confirmed it exists after a search?

e.g. once the script finds the cell location for "App Name" in each sheet - then I want it to be echoed out to me

$i=0
foreach ($b in $b_names)
{
   $b = $b_names[$i]
   $sheet = $wb.Worksheets.Item($B)/>/>

   $range = $sheet.Range("B1").EntireColumn
   $s = $range.find("App Name")

   $i=$i+1
}


Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Powershell - Get the cell location (e.g. B32) after running search

#2 mojo666  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 337
  • View blog
  • Posts: 730
  • Joined: 27-June 09

Re: Powershell - Get the cell location (e.g. B32) after running search

Posted 08 October 2013 - 12:47 PM

The result of $range.find is being stored in $s. This result is itself a range which means it is one or more cells. You can use $s to print the row and column of the result. I would suggest trying

$s.row
$s.column


But you may have to dig into $s.cells
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1