The Problem (Q-score 41, ranked #8th of 303 in the Excel VBA archive)
The scenario as originally posted in 2008
How can I find the last row that contains data in a specific column and on a specific sheet?
Why this Range / Worksheet targeting trips people up
The question centers on reaching a specific cell, range, or workbook object. In Excel VBA, this is the #1 source of failures after activation events: every property (.Value, .Formula, .Address) behaves differently depending on whether the parent Workbook is explicit or implicit.
The Verified Solution — elite answer (top 10 %%) (+30)
9-line Excel VBA pattern (copy-ready)
How about:
Sub GetLastRow(strSheet, strColum)
Dim MyRange As Range
Dim lngLastRow As Long
Set MyRange = Worksheets(strSheet).Range(strColum & "1")
lngLastRow = Cells(Rows.Count, MyRange.Column).End(xlUp).Row
End Sub
Re Comment
This
Cells.Find("*",SearchOrder:=xlByRows,SearchDirection:=xlPrevious).Row
Will return the row number of the last cell even when only a single cell in the last row has data.
When to Use It — vintage (14+ years old, pre-2013)
A top-10 Excel VBA pattern — why it still holds up
Ranks #8th of 303 in the Excel VBA archive. The only pattern ranked immediately above it is “How to change Format of a Cell to Text using VBA” — compare both if you’re choosing between approaches.
What changed between 2008 and 2026
The answer is 18 years old. The Excel VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.