From 0926bd1186c356dbe4e4305eb74192ce7816494c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:25:39 +0000 Subject: [PATCH 1/2] Initial plan From c77283b2c0b12307d0d50731aa951b6dae7e5854 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:28:06 +0000 Subject: [PATCH 2/2] findQueryInRow: change searchRow parameter type from String to Range --- README.md | 2 +- findQueryInRow.bas | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ec6a7e4..91be47f 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Finds queried value in a specified row and returns the column number where the q **Input**: 1. `String` Search Worksheet Name _(ex. "Sheet 1")_ 2. `String` Search Term _(ex. "foo")_ -3. `String` Search Row _(ex. "1:1")_ +3. `Range` Search Row _(ex. Range("1:1"))_ **Output**: `Integer` Column Number diff --git a/findQueryInRow.bas b/findQueryInRow.bas index ad868fd..2ec0d6a 100644 --- a/findQueryInRow.bas +++ b/findQueryInRow.bas @@ -3,10 +3,10 @@ ''''''''''''''''''''''''''''''''''''''''''''''' ' *** Requires Function "getColumnLetter" *** -'recieves input of worksheet (ex. "Sheet 1"), search term (ex. "foo"), and range (ex. "1:1") as string +'receives input of worksheet (ex. "Sheet 1"), search term (ex. "foo"), and range (ex. Range("1:1")) as Range 'outputs column number as integer -Function findQueryInRow(searchWorksheet As String, searchTerm As Variant, searchRow As String) As Integer +Function findQueryInRow(searchWorksheet As String, searchTerm As Variant, searchRow As Range) As Integer '''method 1 'dimension variables @@ -15,7 +15,7 @@ Function findQueryInRow(searchWorksheet As String, searchTerm As Variant, search Dim foundCol As Integer 'find the search term within the search range - Dim foundSearchTerm As range: Set foundSearchTerm = ws.range(searchRow).Find(what:=searchTerm, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False) + Dim foundSearchTerm As range: Set foundSearchTerm = searchRow.Find(what:=searchTerm, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False) 'if search term is found return row number 'else try method 2 @@ -30,15 +30,15 @@ Function findQueryInRow(searchWorksheet As String, searchTerm As Variant, search 'dimension variables 'find the column letter of the last column in the search row - Dim searchRowLastColumnLetter As String: searchRowLastColumnLetter = common.getColumnLetter(ws.range(common.getColumnLetter(Columns.count) & ws.range(searchRow).row).End(xlToLeft).Column) + Dim searchRowLastColumnLetter As String: searchRowLastColumnLetter = common.getColumnLetter(ws.range(common.getColumnLetter(Columns.count) & searchRow.row).End(xlToLeft).Column) 'find the last row in the search search row - Dim searchRowLastRow As String: searchRowLastRow = ws.range(searchRow).row + Dim searchRowLastRow As String: searchRowLastRow = searchRow.row 'find the last cell in the search row Dim searchRowLastCell As range: Set searchRowLastCell = ws.range(searchRowLastColumnLetter & searchRowLastRow) - Dim row As Integer: row = ws.range(searchRow).row + Dim row As Integer: row = searchRow.row Dim i As Long Dim foundMatch As Boolean: foundMatch = False Dim compare As String