View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default MACRO: Catching only filled cell data

Sub nonempty()
Dim rr As Range, r2 As Range, r3 As Range
Dim r4 As Range
Set r2 = ActiveSheet.UsedRange
Set r3 = ActiveSheet.UsedRange.SpecialCells(xlCellTypeBlank s)
For Each rr In r2
If Intersect(rr, r3) Is Nothing Then
If r4 Is Nothing Then
Set r4 = rr
Else
Set r4 = Union(r4, rr)
End If
End If
Next
r4.Select
End Sub

But it wil not select cells that have only comments in them.
--
Gary's Student


"sumit" wrote:

I want to have a macro to select the cells with only filled data . I
have tried with the dollar sign to select the entire sheet but it does
not work. just give in options

Thankue