Return first row number in a range
This tutorial shows how to return the first row number from a selected range using an Excel formula or VBA
Example: Return first row number in a range
=ROW(B5:C10)
|
This formula uses the Excel ROW function to return the row number of the first cell in the selected range. In this example the first row in the range is row 5.
|
Sub Return_first_row_number_in_range()
'declare variables
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'return the first column number in a range
ws.Range("E5") = ws.Range("B5:C10").Row
ws.Range("E5") = ws.Range("B5:C10").Row
End Sub
EXPLANATION
This tutorial shows how to return the first row number from a selected range through the use of an Excel formula or VBA.
Using the ROW function in both the Excel and VBA methods in will return the first row number in a selected range.
FORMULA
=ROW(range)
=ROW(range)
ARGUMENTS
range: A range of cells for which you want to return the first row number.
range: A range of cells for which you want to return the first row number.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Return first column number in a range | How to return the first column number from a selected range using Excel and VBA | |
Return row number of a specific value | How to return a row number of a specific value using Excel and VBA |
RELATED FUNCTIONS
Related Functions | Description | Related Functions and Description |
---|---|---|
ROW Function | The Excel ROW function returns the first row number of the selected reference |