View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default select populated cells

Dim rng1 as Range, rng2 as Range, rng3 as Range
On Error resume next
set rng1 = Activesheet.Cells.SpecialCells(xlconstants)
set rng2 = Activesheet.Cells.SpecialCells(xlFormulas)
On Error goto 0
if not rng1 is nothing and not rng2 is nothing then
set rng3 = Union(rng1,rng2)
elseif not rng1 is nothing then
set rng3 = rng1
elseif not rng2 is nothing then
set rng3 = rng2
End if
if not rng3 is nothing then
rng3.Select
End if

--
Regards,
Tom Ogilvy

"Kevin" wrote in message
...
i hate to ask this, because i'm sure it's come up a
million times before, but i've searched high and low and
couldn't find anything:

how do you select all of the populated cells of a
worksheet?