Skip to content

Add lastRow function#32

Merged
physics515 merged 2 commits into
mainfrom
copilot/add-lastrow-function
Jun 3, 2026
Merged

Add lastRow function#32
physics515 merged 2 commits into
mainfrom
copilot/add-lastrow-function

Conversation

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Adds a lastRow utility function that returns the last used row number for a given column in a worksheet.

Changes

  • lastRow.bas — New function using End(xlUp) from the bottom of the column to find the last used row; depends on common.getColumnLetter
  • README.md — Documentation added in alphabetical order

Usage

' Returns the last used row number in column A of "Sheet 1"
Dim row As Long
row = common.lastRow("Sheet 1", "A:A")

Input: String Worksheet Name, String Column Range (e.g. "A:A")
Output: Long Last used row number

Copilot AI linked an issue Jun 3, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add function that returns the last row for a given column Add lastRow function Jun 3, 2026
Copilot AI requested a review from physics515 June 3, 2026 17:30
@physics515 physics515 marked this pull request as ready for review June 3, 2026 19:08
Copilot AI review requested due to automatic review settings June 3, 2026 19:08
@physics515 physics515 merged commit 0ce0921 into main Jun 3, 2026
@physics515 physics515 deleted the copilot/add-lastrow-function branch June 3, 2026 19:09

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

Adds a lastRow utility to the VBA common library to return the last used row number in a specified worksheet column, along with README documentation for the new helper.

Changes:

  • Added lastRow function that finds the last used row in a given column using End(xlUp).
  • Documented the new Last Row utility in README.md.

Reviewed changes

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

File Description
README.md Adds documentation for the new Last Row utility entry.
lastRow.bas Introduces the lastRow function to compute the last used row for a specified column.

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

Comment thread lastRow.bas
Dim searchColumnLetter As String: searchColumnLetter = common.getColumnLetter(ws.Range(searchColumn).Column)

'find and return the last row in the search column
lastRow = ws.Range(searchColumnLetter & Rows.Count).End(xlUp).Row
Comment thread lastRow.bas
'''''''''''''''''''''''''''''''''''''''''''''''
' *** Requires Function "getColumnLetter" ***

'recieves input of worksheet (ex. "Sheet 1") and column range (ex. "A:A") as string
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.

Add lastRow function

3 participants