Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Location: Kyle, TX, USA
Posts: 2
Cool Setting a range in a named range

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))

But it tries to process 1,048,576 rows. !!!!

What I need is the correct way to write something like...

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

How do I specify a named range-row?

How do I specify the last row in a range that actually has data?

Thanks!
Jerry
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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))


  #3   Report Post  
Junior Member
 
Location: Kyle, TX, USA
Posts: 2
Talking

Quote:
Something like:

Dim MyRange As Range
Set MyRange = Range(Range("ALPHA")(RowIndex:=2), Cells(Rows.Count, Range("ALPHA").Column).End(xlUp))
That worked perfectly! Thank you so very much!

Jerry
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,045
Default Setting a range in a named range

On Fri, 9 Nov 2012 18:59:35 +0000, Askjerry wrote:



Something like:

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



That worked perfectly! Thank you so very much!

Jerry


Glad to help. Thanks for the feedback.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a column of a 2D array = named range SantaClaus Excel Programming 3 June 22nd 10 09:15 AM
Named ranges vs setting range in code Tim Excel Programming 2 February 24th 06 02:50 AM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
setting a range using a named list in vba Gixxer_J_97[_2_] Excel Programming 12 March 12th 05 05:11 PM
Setting named range in VBA- how to set as formula/reference instead of text string? Keith R[_3_] Excel Programming 1 July 28th 03 10:26 PM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"