Here is several ways to find the last used row & column
'find row before next blank cell in column A
iLastRow = Range("A1").End(xlDown).Row
'find last used row in column A
iLastRow = Cells(Rows.Count, "a").End(xlUp).Row
'find last used row on sheet
iLastRow = Cells.Find(what:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
'find column before next blank cell in row 1
iLastColumn = Range("A1").End(xlToRight).Column
'find last used column in row 1
iLastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
'find last used column on sheet
iLastColumn = Cells.Find(what:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
'set variable to last used cell
Dim rLC As Range
Set rLC = ActiveSheet.UsedRange
Set rLC = ActiveCell.SpecialCells(xlLastCell)
With rows(iLastRow).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Bookmarks