Question related to VBA code.

Iron Contributor

Hello Everyone, 


 I want something different in VBA code. 


Like if I have data in A Column from A1 to A13 and

in B Column, the data is from B1 to B4 and B6 to B8


If I will apply VBA - Range(ActiveCell, ActiveCell.End(xlDown)).Select, it will only select data from B1 to B4.


But I want to select data from B1 (ActiveCell) to B13 (Last used row in that worksheet)


It can be done by ASAP Utilities.

ASAP > Select > 9.Extend Selection to the last used row


Please help..??


Here is a attached file...


2 Replies


Sub SelectToLastRow()
    Dim LastRow As Long
    LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range(ActiveCell, Cells(LastRow, ActiveCell.Column)).Select
End Sub

@Excel Try below simple macro.

Sub SelectTillLast()
Dim lr As Long
    lr = Cells(Rows.Count, "A").End(xlUp).Row
    Range("B1:B" & lr).Select
End Sub