findQueryInRow: accept Range instead of String for searchRow parameter#27
Conversation
|
@copilot resolve the merge conflicts in this pull request |
Merge conflicts resolved in caf5d7b. The conflict was between this PR's |
There was a problem hiding this comment.
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
findQueryInRowsignature:searchRow As String→searchRow As Range, and replacedws.Range(searchRow)usage with directsearchRowusage. - Updated README documentation to reflect the new
Rangeinput 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.
| '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) |
| '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) |
| 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 |
| 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"))_ |
findQueryInRowacceptedsearchRow As String(e.g."1:1"), requiring internalws.Range(searchRow)calls. The parameter now acceptsRangedirectly.Changes
findQueryInRow.bas:searchRow As String→searchRow As Range; allws.Range(searchRow)references replaced with directsearchRowusageREADME.md: updated input type fromStringtoRangewith updated exampleUsage
Before:
After: