Thread: Named Range?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
BSc Chem Eng Rick BSc Chem Eng Rick is offline
external usenet poster
 
Posts: 118
Default Named Range?

Hi Martin

VB refers to ALL names defined in a worksheet as an object (Name object). To
use your specific name you need to call it by indexing in one of two ways.

1) Names are organised alphabetically and then indexed numerically i.e. if
you had "Apples", "Bananas" and "Oranges", then Apples is indexed as 1,
Bananas as 2 etc. If you wanteed to use apples in the VB code you would call
it as follows:
MyRange = Names (1).
I don't like this because if you add a name that comes before this one
alphabetically, I can't tell whether excel automatically reindexes so that
the code still refers to the right range.

2) Use the names object to call you range by its name:
MyRange = Names("Apples")

Hope this helps.

"Martin" wrote:

Hello,

I have this code on the followhyperlink:

If ActiveCell.Address = "$B$6" Then Rows("11:110").EntireRow.Hidden = False

The rows 11 to 110 may change so I want to use named ranges but when I name
this range the code doesnt work. Is there a different way to reference the
named range?

Thanks in advance.

Martin