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

Is it possible to set up column heads for a named range and refer to them
programatically. For example.


Week ColStart ColEnd
1 4 19
2 1 16
3 2 18


Something like . . . . .

Range.cells( 1, Range.ColStart)

???



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default NamedRange Column Names

If you give the cells that contain the headers specific range names you
could refer to the other cells using the form

Dim CellVal as Long
CellVal = Cells(Range("Week").Row+1,Range("ColEnd").Column). value

In this case the +1 is the row offset for week 1

Or you could use "Offset" - by selecting the cell containing "Week" the
ColEnd for week 1 becomes

Dim CellVal as Long
Range("Week").Select
ActiveCell.Offset(1,2).Value

However be careful if you start to insert new rows or columns

Goofy wrote:
Is it possible to set up column heads for a named range and refer to them
programatically. For example.


Week ColStart ColEnd
1 4 19
2 1 16
3 2 18


Something like . . . . .

Range.cells( 1, Range.ColStart)

???


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default NamedRange Column Names

Thanks Alan,

I did think about this, and decided to use a Global Constant to refer to the
column offset numbers instead, its a bit clunky but will work provided I
remember to update them.

The reason I chose to do this was that I am able to refer to the value using
code completion which makes life easier than trying to remember the
RangeName.

As a .NET developer I am used to being able to refer to a typed dataset by
columnName which makes like so much easier and readable.

Thanks again for your input.





"Alan" wrote in message
ups.com...
If you give the cells that contain the headers specific range names you
could refer to the other cells using the form

Dim CellVal as Long
CellVal = Cells(Range("Week").Row+1,Range("ColEnd").Column). value

In this case the +1 is the row offset for week 1

Or you could use "Offset" - by selecting the cell containing "Week" the
ColEnd for week 1 becomes

Dim CellVal as Long
Range("Week").Select
ActiveCell.Offset(1,2).Value

However be careful if you start to insert new rows or columns

Goofy wrote:
Is it possible to set up column heads for a named range and refer to them
programatically. For example.


Week ColStart ColEnd
1 4 19
2 1 16
3 2 18


Something like . . . . .

Range.cells( 1, Range.ColStart)

???




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
How to Add NamedRange Controls to Worksheets? lijipan Excel Worksheet Functions 0 November 16th 07 04:40 PM
Addressing cells in a NamedRange Mike[_51_] Excel Programming 6 May 15th 04 09:13 PM
Change names of files in a folder to match names in Excel Column saybut Excel Programming 4 February 9th 04 06:26 PM
Cell Reference within NamedRange ExcelMonkey[_12_] Excel Programming 1 January 21st 04 10:37 PM
sum (column 2 of namedrange) Alan Beban[_3_] Excel Programming 2 August 21st 03 10:11 PM


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