Return address of last cell in a range

This tutorial shows how to return the address of a last cell in a specific range using an Excel formula or VBA

Example: Return address of last cell in a range

Return address of last cell in a range

METHOD 1. Return address of last cell in a range using Excel formula

EXCEL

=ADDRESS(ROW(B5:C10)+ROWS(B5:C10)-1,COLUMN(B5:C10)+COLUMNS(B5:C10)-1)
This formula uses the Excel ADDRESS, ROW, ROWS, COLUMN and COLUMNS functions with the range from which you want to return the address of the last cell inserted as the reference in the ROW, ROWS, COLUMN and COLUMNS functions.

METHOD 1. Return address of last cell in a range using VBA

VBA

Sub Address_of_last_cell_in_range()
'declare variables
Dim ws As Worksheet
Dim rng As Range
Set ws = Worksheets("Analysis")
Set rng = ws.Range("B5:C10")
'return the address of the last cell in a specified range
ws.Range("E5") = rng(1).Cells(rng.Rows.Count, rng.Columns.Count).Address

End Sub

Explanation about how to return address of last cell in a range

EXPLANATION

EXPLANATION

This tutorial shows how to return an address of a last cell in a range through the use of an Excel formula or VBA.
The Excel formula uses the ADDRESS, ROW, ROWS, COLUMN and COLUMNS functions to return the address of the last cell in the specified range, whilst the VBA method uses only the Address function.
FORMULA
=ADDRESS(ROW(range)+ROWS(range)-1,COLUMN(range)+COLUMNS(range)-1)
ARGUMENTS
range: The range from which to return the address of the last cell.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to return the address of a specific cell using Excel and VBA
How to return the address of an active cell using Excel and VBA
How to return the address of a first cell in a specific range using Excel and VBA

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel ADDRESS function returns a cell reference as a string, based on a row and column number
The Excel ROW function returns the first row number of the selected reference
The Excel ROWS function returns the number of rows in a specified array
The Excel COLUMN function returns the first column number of the selected reference
The Excel COLUMNS function returns the number of columns in a specified array