ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Nested Ranges? (https://www.excelbanter.com/excel-programming/375860-nested-ranges.html)

[email protected]

Nested Ranges?
 
Is it possible to a range within a range? For example to select a range
made up of two names I use the following:

Range("BINFilStart:colBend").Offset(0, 1).Select

However, BINFilStart should be offset and colBend should not. To meet
that need Ive tried a few things along the lines of:

Range("range(""BINFilStart"".Offset(0, 1)):colBend").Select



Nothing has worked and in this case I get runtime error 1004 Method
'Range' of object '_Global' failed. So far I can't find
anything in my references on nesting ranges.

Maybe I need a new approach?


PCLIVE

Nested Ranges?
 
Try this:

Range(Range("BINFilStart").Offset(0, 1).Address & ":colBend").Select

Regards,
Paul

wrote in message
oups.com...
Is it possible to a range within a range? For example to select a range
made up of two names I use the following:

Range("BINFilStart:colBend").Offset(0, 1).Select

However, BINFilStart should be offset and colBend should not. To meet
that need Ive tried a few things along the lines of:

Range("range(""BINFilStart"".Offset(0, 1)):colBend").Select



Nothing has worked and in this case I get runtime error 1004 Method
'Range' of object '_Global' failed. So far I can't find
anything in my references on nesting ranges.

Maybe I need a new approach?




Jim Thomlinson

Nested Ranges?
 
Range takes two arguments. The second one is optional. The range is made up
of the rectangle where each cell is one of the corners... For example

Range(Range("A1"), Range("D5"))
is the same as
Range("A1:D5")

So for your problem...
Range(Range("BINFilStart").Offset(0, 1), Range("colBend")).Select

--
HTH...

Jim Thomlinson


" wrote:

Is it possible to a range within a range? For example to select a range
made up of two names I use the following:

Range("BINFilStart:colBend").Offset(0, 1).Select

However, BINFilStart should be offset and colBend should not. To meet
that need Ive tried a few things along the lines of:

Range("range(""BINFilStart"".Offset(0, 1)):colBend").Select



Nothing has worked and in this case I get runtime error 1004 Method
'Range' of object '_Global' failed. So far I can't find
anything in my references on nesting ranges.

Maybe I need a new approach?



[email protected]

Nested Ranges?
 
Thanks Paul, that works perfect
Robert


PCLIVE (RemoveThis) wrote:
Try this:

Range(Range("BINFilStart").Offset(0, 1).Address & ":colBend").Select

Regards,
Paul

wrote in message
oups.com...
Is it possible to a range within a range? For example to select a range
made up of two names I use the following:

Range("BINFilStart:colBend").Offset(0, 1).Select

However, BINFilStart should be offset and colBend should not. To meet
that need Ive tried a few things along the lines of:

Range("range(""BINFilStart"".Offset(0, 1)):colBend").Select



Nothing has worked and in this case I get runtime error 1004 Method
'Range' of object '_Global' failed. So far I can't find
anything in my references on nesting ranges.

Maybe I need a new approach?



[email protected]

Nested Ranges?
 
Thanks Jim, that is an excelent description, and examples of nesting
ranges :)


Jim Thomlinson wrote:
Range takes two arguments. The second one is optional. The range is made up
of the rectangle where each cell is one of the corners... For example

Range(Range("A1"), Range("D5"))
is the same as
Range("A1:D5")

So for your problem...
Range(Range("BINFilStart").Offset(0, 1), Range("colBend")).Select

--
HTH...

Jim Thomlinson


" wrote:

Is it possible to a range within a range? For example to select a range
made up of two names I use the following:

Range("BINFilStart:colBend").Offset(0, 1).Select

However, BINFilStart should be offset and colBend should not. To meet
that need Ive tried a few things along the lines of:

Range("range(""BINFilStart"".Offset(0, 1)):colBend").Select



Nothing has worked and in this case I get runtime error 1004 Method
'Range' of object '_Global' failed. So far I can't find
anything in my references on nesting ranges.

Maybe I need a new approach?





All times are GMT +1. The time now is 11:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com