Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default CurrentRegion

Hi. Below is a post from Tom Ogilvy that was posted back in 2003. The post
involved identifying which named range a given cell belonged to. So I took
the below snippets, created a named range called "test" in cells a1:c5. But
when I select b3, and run the below in the immediate window, I get b3 back
for the .address. For .name, I get an error. Am I doing something wrong?

? Range("A1").CurrentRegion.address
$A$1:$C$5
? Range("A1").CurrentRegion.name
=Sheet1!$A$1:$C$5
? Range("A1").CurrentRegion.name.name
MyRange


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default CurrentRegion

A1 to C5 needs to be filled as a block (the CurrentRegion), and not
connected to any other block.

HTH,
Bernie
MS Excel MVP

"Steph" wrote in message
...
Hi. Below is a post from Tom Ogilvy that was posted back in 2003. The

post
involved identifying which named range a given cell belonged to. So I

took
the below snippets, created a named range called "test" in cells a1:c5.

But
when I select b3, and run the below in the immediate window, I get b3 back
for the .address. For .name, I get an error. Am I doing something wrong?

? Range("A1").CurrentRegion.address
$A$1:$C$5
? Range("A1").CurrentRegion.name
=Sheet1!$A$1:$C$5
? Range("A1").CurrentRegion.name.name
MyRange




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CurrentRegion

valid_rangereference.name.name only returns the name if the entire range
defined by the name is offered as the reference

If you selected a1:C5 and did

? selection.Name.Name

it would return Test.

but just selecting a cell within the range will return an error.

You would have to loop through the names collection to discover if a cell
was a subset of a named range.

if you had data in A1:C5 and at least a blank row and column separating that
range from other filled cells, then

?Range("A1").CurrentRegion.Name.Name

would return Test

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hi. Below is a post from Tom Ogilvy that was posted back in 2003. The

post
involved identifying which named range a given cell belonged to. So I

took
the below snippets, created a named range called "test" in cells a1:c5.

But
when I select b3, and run the below in the immediate window, I get b3 back
for the .address. For .name, I get an error. Am I doing something wrong?

? Range("A1").CurrentRegion.address
$A$1:$C$5
? Range("A1").CurrentRegion.name
=Sheet1!$A$1:$C$5
? Range("A1").CurrentRegion.name.name
MyRange




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
currentregion flow23 Excel Discussion (Misc queries) 13 November 23rd 05 05:02 PM
Formula equivalent of CurrentRegion bdr200 Excel Worksheet Functions 1 June 14th 05 11:41 AM
CurrentRegion Selecting He4Giv Excel Programming 2 January 31st 04 07:13 PM
CurrentRegion Failure. Please help! John T Ingato Excel Programming 2 November 9th 03 11:12 PM
CurrentRegion.copy maybe? Bob Phillips[_5_] Excel Programming 5 September 7th 03 10:20 PM


All times are GMT +1. The time now is 05:54 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"