select cells

  • Thread starter Thread starter puiuluipui
  • Start date Start date
This macro should do what you want...

Sub SelectNonEmptyCellsBelowActiveCell()
Dim LastCell As Range
On Error Resume Next
Set LastCell = Cells(Rows.Count, ActiveCell.Column).End(xlUp)
Range(ActiveCell.Offset(1), LastCell).SpecialCells( _
xlCellTypeConstants).Select
End Sub
 
To select cells below the active cell with data in them:

Sub WithData()
Set r = Range(ActiveCell.Offset(1, 0), Cells(Rows.Count, ActiveCell.Column))
Set r = Intersect(r, ActiveSheet.UsedRange)
Set rSelect = Nothing
For Each rr In r
If IsEmpty(rr) Then
Else
If rSelect Is Nothing Then
Set rSelect = rr
Else
Set rSelect = Union(rSelect, rr)
End If
End If
Next
rSelect.Select
End Sub
 
Back
Top