Sub SelectNonEmptyCells()
Dim r1 As Range, r2 As Range, r3 As Range
With Range("A:A") 'Change column to suit
On Error Resume Next
Set r1 = .SpecialCells(xlCellTypeConstants)
Set r2 = .SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If Not r2 Is Nothing Then
For Each c In r2
If c.Value <> "" Then
If r3 Is Nothing Then
Set r3 = c
Else
Set r3 = Union(c, r3)
End If
End If
Next c
If Not r1 Is Nothing Then
If Not r3 Is Nothing Then
Application.Union(r1, r3).Select
Else
r1.Select
End If
ElseIf Not r3 Is Nothing Then
r3.Select
Exit Sub
Else
MsgBox "All cells in the range are empty"
End If
Else
MsgBox "All cells in the range are empty"
End If
End With
End Sub