Thread: Setting ranges
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Setting ranges

Hi
you may try the following to select all non blank cells in column A
Sub foo2()

Dim rng As Range
Dim cell As Range
Dim target_rng As Range
Set rng = Range("A:A")
For Each cell In rng
If cell.Value < "" Then
If target_rng Is Nothing Then
Set target_rng = cell
Else
Set target_rng = Union(target_rng, cell)
End If
End If
Next
target_rng.Select
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Scottie wrote:
how would i set a range for all non empty cells in column
a on a sheet?