Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Select First To Last In Column

Sub SelectFirstToLastInColumn()     Set TopCell = Cells(1, ActiveCell.Column)     Set BottomCell = Cells(16384, ActiveCell.Column)     If IsEmpty(TopCell) Then Set TopCell = TopCell.End(xlDown)     If IsEmpty(BottomCell) Then Set BottomCell = BottomCell.End(xlUp)     If TopCell.Row = 16384 And BottomCell.Row = 1 Then ActiveCell.Select Else Range(TopCell, BottomCell).Select End Sub