View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JasonK[_3_] JasonK[_3_] is offline
external usenet poster
 
Posts: 38
Default Proper syntax for selecting a range using cells instead of range


thanks arjen van,


On Tue, 21 Jul 2009 22:23:01 -0700, arjen van...
wrote:

If there's only one range of data on the sheet you can use something like:

Dim DataRange As Range
Set DataRange = Sheet1.UsedRange

Or if there's a certain point that the range begins, ends at, or contains
you can try:

Dim DataRange As Range
Set DataRange = Sheet1.Range("A20").CurrentRegion

This should work without having to create a variable as long as you don't
have a discontinuos range.