<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: Excel - Best way to locate cell next cell that does not contain a specific value in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74494#M27099</link>
    <description>I believe we can filter on that column with criteria as "Contains"&amp;nbsp; and then get the row count.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;MuraliKrishna&lt;BR /&gt;Senior Consultant - Automation Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Sun, 14 Nov 2021 15:27:00 GMT</pubDate>
    <dc:creator>krishna.kodimurali9</dc:creator>
    <dc:date>2021-11-14T15:27:00Z</dc:date>
    <item>
      <title>Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74488#M27093</link>
      <description>Hey!&lt;BR /&gt;&lt;BR /&gt;So I am currently working on a process where I have to write a LOT of data from a large excel file, like 16K lines.&lt;BR /&gt;I have sorted the whole file and now I need to locate all lines in a specific column that contains a certain value, in this case "104". I know for sure that we will have lines with 104, but all other values is not known from time to time. So I need a way to locate the start row and end row of the rows with 104 in one column.&lt;BR /&gt;&lt;BR /&gt;My thinking is to got to the first cell in that column, get the value, check if it's 104, if not use this code stage to go to next cell that is not that value and check this value. Then keep on doing this until I have located the start and end row with 104.&lt;BR /&gt;&lt;BR /&gt;I think this could be easy to do by using the "MS VBO Extended - CUSTOM_Find Next Cell With Text Value"&lt;BR /&gt;&lt;BR /&gt;Input: handle, direction, value&lt;BR /&gt;Output: cellref&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim strDir as String = direction.Trim().Substring(0,1).ToUpper()&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim excel as Object = GetInstance(handle)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim dirn as Integer = 0&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Select Case strDir&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "U"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4162 ' Excel.XlDirection.xlToUp&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "D"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4121 ' Excel.XlDirection.xlToDown&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "L"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4159 ' Excel.XlDirection.xlToLeft&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "R"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4161 ' Excel.XlDirection.xlToRight&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case Else&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Throw New ArgumentException("Invalid Direction: " &amp;amp; strDir)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End Select&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim cell as Object = excel.ActiveCell&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;While True&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim nextCell as Object = GetNextCell(cell, strDir)&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;If cell.Address = nextCell.Address Then&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cellref = ""&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Return&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;ElseIf cstr(nextCell.Value) = value Then ' We've found our blank&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cellref = nextCell.Address(False,False)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Return&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End If&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;cell = nextCell&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;End While&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is anyone able to help modify this code stage to find the next cell that does NOT contain the value?&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Stefan Hansen&lt;BR /&gt;RPA Dev&lt;BR /&gt;Bestseller&lt;BR /&gt;Europe/Copenhagen&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2021 11:14:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74488#M27093</guid>
      <dc:creator>stefan.hansen</dc:creator>
      <dc:date>2021-11-11T11:14:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74489#M27094</link>
      <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/37487"&gt;@stefan.hansen&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;From the looks of it, your code should match whatever you pass in to it as &lt;STRONG&gt;value&lt;/STRONG&gt;.&amp;nbsp; So, if you set the active cell of the worksheet to something at the top (ex. cell A1) and call this code with direction set to &lt;STRONG&gt;D&lt;/STRONG&gt; then it will search​ the cells in column A going down and return the first one it reaches that matches your value. Then if you set the active cell of the worksheet to the last cell in column A and call this action again with the direction set to &lt;STRONG&gt;U&amp;nbsp;&lt;/STRONG&gt;it should search the column values going up from the bottom and return the first cell it matches. Assuming the range of values you're looking for are consecutive (i.e. no other values interspersed) you now have the first and last cell.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2021 14:49:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74489#M27094</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2021-11-11T14:49:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74490#M27095</link>
      <description>" I have sorted the whole file and now I need to locate all lines in a specific column that contains a certain value, in this case "104"."&lt;CODE&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;/CODE&gt;If you want to indicate all the lines having any specific value in a collection, in that case I have modified the code in such a way that you need to provide the following inputs &amp;amp; outputs:&lt;BR /&gt;&lt;BR /&gt;Inputs:&lt;BR /&gt;
&lt;UL&gt;
&lt;LI&gt;handle : The excel instance handler&lt;/LI&gt;
&lt;LI&gt;direction: The cell direction which can be either, "L","R","D" or "U"&lt;/LI&gt;
&lt;LI&gt;cellref: The cell reference from where you need to start the comparison&lt;/LI&gt;
&lt;LI&gt;workbookname: The name of the excel workbook&lt;/LI&gt;
&lt;LI&gt;worksheetname: The name of the excel worksheet&lt;/LI&gt;
&lt;LI&gt;value: The value to be matched&lt;/LI&gt;
&lt;/UL&gt;
Outputs:&lt;BR /&gt;
&lt;UL&gt;
&lt;LI&gt;lines: A dynamic collection holding no values initially. After code execution, line numbers consisting of that specific value will be stored in a single column called "lineNo"&lt;/LI&gt;
&lt;/UL&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim strDir as String = direction.Trim().Substring(0,1).ToUpper()&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim excel as Object = GetInstance(handle)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim dirn as Integer = 0&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Select Case strDir&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "U"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4162 ' Excel.XlDirection.xlToUp&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "D"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4121 ' Excel.XlDirection.xlToDown&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "L"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4159 ' Excel.XlDirection.xlToLeft&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case "R"&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;dirn = -4161 ' Excel.XlDirection.xlToRight&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Case Else&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Throw New ArgumentException("Invalid Direction: " &amp;amp; strDir)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End Select&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim totalRows As Integer = GetWorksheet(handle,workbookname,worksheetname).Cells.Find("*", , , , , 2).Row&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim lineCount As Integer = 1&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;excel.ActiveSheet.Range(cellref,cellref).Activate()&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim cell as Object = excel.ActiveCell&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim temp As New DataTable&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;temp.Columns.Add("lineNo", GetType(Integer))&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;For i As Integer = 0 To totalRows&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim nextCell as Object = GetNextCell(cell, strDir)&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;If nextCell.Value = value Then ' We've found our value&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;temp.Rows.Add(lineCount)&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End If&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;cell = nextCell&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;lineCount +=1&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Next&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;lines=temp&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;In case you require only start and end row, the collection initial and end row can be also taken as per your requirement.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Automation Consultant&lt;BR /&gt;Blueprism 6x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Nov 2021 21:01:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74490#M27095</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2021-11-11T21:01:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74491#M27096</link>
      <description>Of cause! I feel stupid I didn't just do that. Thank for the help. Sometimes you just need another set of eyes on something to see it clearly.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Stefan Hansen&lt;BR /&gt;RPA Dev&lt;BR /&gt;Bestseller&lt;BR /&gt;Europe/Copenhagen&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:45:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74491#M27096</guid>
      <dc:creator>stefan.hansen</dc:creator>
      <dc:date>2021-11-12T09:45:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74492#M27097</link>
      <description>Thanks! I'll check it out and test it. seems like a great solution.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Stefan Hansen&lt;BR /&gt;RPA Dev&lt;BR /&gt;Bestseller&lt;BR /&gt;Europe/Copenhagen&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:48:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74492#M27097</guid>
      <dc:creator>stefan.hansen</dc:creator>
      <dc:date>2021-11-12T09:48:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74493#M27098</link>
      <description>Hi Stefan&lt;BR /&gt;&lt;BR /&gt;For 14k+ rows going through each one and identifying the individual cell references may take a long time and slow your process down. I've had a similar issue before and what I did was to turn on filters and filter the columns with the value I was looking for and then use find last empty cell to identify how many rows there are then I was able to take those rows into a collection. If you wanted to try something similar the code for turning filters on/off is below and also the code for filtering the columns.&lt;BR /&gt;&lt;BR /&gt;Turn on/off filters - Input values handle, Source Worksheet, Source Worbook, Filter range&amp;nbsp;&lt;BR /&gt;----------------------------------------------------------------------------------------------&lt;BR /&gt;Dim wb, ws As Object&lt;BR /&gt;Dim excel, sheet, range As Object&lt;BR /&gt;&lt;BR /&gt;wb = GetWorkbook(handle, Source_Workbook)&lt;BR /&gt;ws = GetWorksheet(handle, Source_Workbook, Source_Worksheet)&lt;BR /&gt;&lt;BR /&gt;wb.Activate()&lt;BR /&gt;ws.Activate()&lt;BR /&gt;excel = ws.Application&lt;BR /&gt;sheet = excel.ActiveSheet&lt;BR /&gt;range = sheet.Range(Filter_range)&lt;BR /&gt;range.Select()&lt;BR /&gt;&lt;BR /&gt;excel.Selection.AutoFilter&lt;BR /&gt;&lt;BR /&gt;================================================&lt;BR /&gt;&lt;BR /&gt;Filter columns - Inputs handle, range, workbookname, worksheetname, columnnumber, criteriastring. Outputs - success, message&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Dim ws as Object, strList as Object&lt;BR /&gt;&lt;BR /&gt;ws = GetWorksheet(handle, workbookname, worksheetname)&lt;BR /&gt;&lt;BR /&gt;Try&lt;BR /&gt;&lt;BR /&gt;If (criteriastring&amp;lt;&amp;gt;"") Then&lt;BR /&gt;strList = Split(criteriastring,",",-1)&lt;BR /&gt;'ColNum = ws.Range(range).Find(columnname).Column&lt;BR /&gt;ws.Range(range).AutoFilter(Field:=columnnumber, Criteria1:= strList, Operator:=7)&lt;BR /&gt;success = True&lt;BR /&gt;Else &lt;BR /&gt;success = False&lt;BR /&gt;message = "CriteriaString should not be blank"&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Catch ex as exception&lt;BR /&gt;&lt;BR /&gt;success = False&lt;BR /&gt;message = ex.Message&lt;BR /&gt;&lt;BR /&gt;End Try&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Michael ONeil&lt;BR /&gt;Technical Lead developer&lt;BR /&gt;Everis Consultancy&lt;BR /&gt;Europe/London&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2021 10:20:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74493#M27098</guid>
      <dc:creator>michaeloneil</dc:creator>
      <dc:date>2021-11-12T10:20:00Z</dc:date>
    </item>
    <item>
      <title>RE: Excel - Best way to locate cell next cell that does not contain a specific value</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74494#M27099</link>
      <description>I believe we can filter on that column with criteria as "Contains"&amp;nbsp; and then get the row count.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;MuraliKrishna&lt;BR /&gt;Senior Consultant - Automation Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Nov 2021 15:27:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Excel-Best-way-to-locate-cell-next-cell-that-does-not-contain-a/m-p/74494#M27099</guid>
      <dc:creator>krishna.kodimurali9</dc:creator>
      <dc:date>2021-11-14T15:27:00Z</dc:date>
    </item>
  </channel>
</rss>

