View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Setting a range in a named range

On Thu, 8 Nov 2012 21:48:23 +0000, Askjerry wrote:


Let's say I named the first column "ALPHA" and that I want to perform
some function on it...

If I use this...
Set myRange = Range("A2", Range("A65536").End(xlUp))

It will process only those rows with data in them... so if I type
information into the first 5 rows... it will process rows 2 through 5.
All good.

But if someone inserts a column... the process looks at the wrong
field... so I tried...

Set myrange = Range(Range("ALPHA"), Range("ALPHA").End(xlUp))


Something like:

Dim MyRange As Range
Set MyRange = Range(Range("ALPHA")(RowIndex:=2), _
Cells(Rows.Count, Range("ALPHA").Column).End(xlUp))