Excel vba find last column with data
- how to find last row in vba
- how to select last row in vba
- how to find last row in excel vba
- how to find last row in range vba
Vba last column
Vba get last column letter!
When working with Excel, you may need to determine the last row of a dataset to, for example, identify where you can append new data.
In this tutorial, I will show you some easy ways of finding the last row of a dataset using VBA.
Find Last Row Using VBA
ToggleFind the Last Row Using the Range.CurrentRegion Property
The ‘Range.CurrentRegion’ property produces a range object representing the current region.
The current region is a block of cells enclosed by any combination of blank columns and blank rows.
The syntax of the property:
expression.CurrentRegionexpression is a variable standing for a range object.
Suppose you have the following dataset on Sheet1 showing the average gas prices in various states:
You can use the VBA code below to ascertain the dataset’s last row:
When you execute the code, it identifies the dataset’s last row and displays a message box indicating the row number:
Explanation of the Code
This VBA code determines the last row with data in column A of the current region in ‘Sheet1’ and shows
- how to find last empty row in vba
- how to find last row and column in vba