View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Selecting all cells with content using a variable

This will select all without the top row

Sub selectem()
ActiveSheet.UsedRange.Offset(1).Select
'or
'ActiveSheet.UsedRange.Offset(1).clear
End Sub



On Friday, March 2, 2012 8:02:41 PM UTC-6, Colin Hayes wrote:
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