LASTINROW

LASTINROW(rgeInput)
Returns the address of the last cell that contains data in a particular row.

rgeInputThe row
cellValueWhether to return the value in the cell.
onlyColumnNoWhether to return just the column letter.

REMARKS
Columns=1

 A
1test

Public Function LASTINROW( _ 
        rngInput As Range) _
        As Variant

Dim WorkRange As Range
Dim i As Integer
Dim CellCount As Integer

    Application.Volatile
    Set WorkRange = rngInput.Rows(1).EntireRow
    Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange)
    CellCount = WorkRange.Count
    For i = CellCount To 1 Step -1
        If Not IsEmpty(WorkRange(i)) Then
            LASTINROW = WorkRange(i).Value
            Exit Function
        End If
    Next i
End Function

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext