Return row number of the last non-blank cell in a column

To return a row number of the last non-blank cell in a single column you will need to use VBA

Example: Return row number of the last non-blank cell in a column

Return row number of the last non-blank cell in a column

METHOD 1. Return row number of the last non-blank cell in a column using VBA

VBA

Sub Return_last_row_number_with_value_in_a_column()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate the last row number in a column with a value
ws.Range("D5") = ws.Range("B" & Rows.Count).End(xlUp).Row

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analysis.
Column Range: In this example we are returning the row number of the last non-blank cell in Column B.

ADJUSTABLE PARAMETERS
Column Range: Select the column from which you want to calculate the last non-blank row number by changing the column reference ("B") to any column in the worksheet, that doesn't conflict with the formula.
Output Range: Select the output range by changing the cell reference ("D5") to any cell in the worksheet, that doesn't conflict with the formula.

Explanation about the formula used to return row number of the last non-blank cell in a column

EXPLANATION

EXPLANATION
This tutorial shows and explains how to return a row number of the last non-blank cell in a column using VBA.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to return a column number of the last non-blank cell in a single row you will need to use VBA