excel vba select last cell in column from selected column code example
Example: excel vba find last column
With Sheet1
LastCol = .Cells(10, .Columns.Count).End(xlToLeft).Column
End With
LastCol = Sheet1.[XFD10].End(xlToLeft).Column
LastCol = Sheet1.[A10].End(xlToRight).Column
LastCol = LastUsedRow(Sheet1.[A1])
Function LastUsedCol(r As Range)
On Error Resume Next
r.Parent.AutoFilterMode = False
With r.Cells.Find("*", r, xlFormulas, , , xlPrevious)
LastUsedCol = 1
LastUsedCol = .Column
End With
End Function