The SpecialCells method will get all data of a particular type...
Set rngStuff = Cells.SpecialCells(xlCellTypeConstants)
-or-
Set rngStuff = Cells.SpecialCells(xlCellTypeFormulas)
Note: xl2010 has problems with SpecialCells on large data areas.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(Data Options add-in: rows/dates/random data & colors)
"Colin Hayes"
wrote in message
...
Hi all
At the end of a macro , I need to select all the cells with content in the worksheet excluding the
first row.
The problem is that the amount of rows and columns to be selected will vary each time I run the
macro.
Sometimes it might need to select for example cells A2:Z270 , or next time it might need to select
cells A2:Y4785 and so on.
Can someone help with some code to select all the cells with content via variables , whatever the
spread , at the end of my macro?
Thanks