Skip to content

findQueryInRow: accept Range instead of String for searchRow parameter#27

Merged
physics515 merged 3 commits into
mainfrom
copilot/find-query-in-row-type-range
Jun 3, 2026
Merged

findQueryInRow: accept Range instead of String for searchRow parameter#27
physics515 merged 3 commits into
mainfrom
copilot/find-query-in-row-type-range

Conversation

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

findQueryInRow accepted searchRow As String (e.g. "1:1"), requiring internal ws.Range(searchRow) calls. The parameter now accepts Range directly.

Changes

  • findQueryInRow.bas: searchRow As StringsearchRow As Range; all ws.Range(searchRow) references replaced with direct searchRow usage
  • README.md: updated input type from String to Range with updated example

Usage

Before:

common.findQueryInRow("Sheet1", "Header", "1:1")

After:

common.findQueryInRow("Sheet1", "Header", ws.Range("1:1"))

Copilot AI changed the title [WIP] Update search row to accept type range instead of string findQueryInRow: accept Range instead of String for searchRow parameter Jun 3, 2026
Copilot AI requested a review from physics515 June 3, 2026 17:28
@physics515

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in caf5d7b. The conflict was between this PR's searchRow As Range change and main's searchWorksheet As Worksheet change (PR #24). Both changes are now combined in the function signature: findQueryInRow(searchWorksheet As Worksheet, searchTerm As Variant, searchRow As Range).

@physics515 physics515 marked this pull request as ready for review June 3, 2026 19:15
Copilot AI review requested due to automatic review settings June 3, 2026 19:15
@physics515 physics515 merged commit abe4f22 into main Jun 3, 2026
@physics515 physics515 deleted the copilot/find-query-in-row-type-range branch June 3, 2026 19:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the findQueryInRow VBA helper to accept a Range for the searchRow parameter instead of a String address, aligning call sites to pass an already-resolved row range and reducing internal ws.Range(...) conversions.

Changes:

  • Updated findQueryInRow signature: searchRow As StringsearchRow As Range, and replaced ws.Range(searchRow) usage with direct searchRow usage.
  • Updated README documentation to reflect the new Range input type and example.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Updates the documented input type for “Find Query In Row” from String to Range and adjusts the example.
findQueryInRow.bas Changes the function signature and switches internal .Find/row references to use a Range parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread findQueryInRow.bas
Comment on lines 16 to +17
'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)
Comment thread findQueryInRow.bas
Comment on lines 31 to +32
'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)
Comment thread findQueryInRow.bas
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
Comment thread README.md
1. `Worksheet` Search Worksheet _(ex. ThisWorkbook.Sheets("Sheet 1"))_
2. `String` Search Term _(ex. "foo")_
3. `String` Search Row _(ex. "1:1")_
3. `Range` Search Row _(ex. Range("1:1"))_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find Query In Row - Should Accept Type Range for Search Row

3 participants