There are various methods to find Last Rows & Cell in a Column. Below are few of them :
#First:
'Last Row in Column A using .End method option:
'Find the last used row in Column A
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
MsgBox LastRow
End Sub
Note:
Rows.Count will count all rows in the worksheet.
End(xlUp)
will start at the last cell in the column and goes up until it finds the first non-blank
cell.
#Second:
'Last Row in Column A
using Rows:
Sub LastRows_Row_example()
Dim LastRow As Long
With ActiveSheet.UsedRange
LastRow = .Rows(.Rows.Count).Row
End With
MsgBox LastRow
With ActiveSheet.UsedRange
LastRow = .Rows(.Rows.Count).Row
End With
MsgBox LastRow
End Sub
#Third:
'Last Row in Column A using . SpecialCells option
Sub SpecialCells_Example_Row()
Dim LastRow As Long
With ActiveSheet
LastRow = .Range("A1").SpecialCells(xlCellTypeLastCell).Row
End With
MsgBox LastRow
End Sub
Dim LastRow As Long
With ActiveSheet
LastRow = .Range("A1").SpecialCells(xlCellTypeLastCell).Row
End With
MsgBox LastRow
End Sub
#Forth:
'Last Row in Column a using
.Find option
Sub Range_Find_Row()
'Finds the last non-blank cell on a sheet/range.
'Finds the last non-blank cell on a sheet/range.
Dim lRow As Integer
lRow = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
MsgBox "Last Row: " & lRow
End Sub