LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to use offset with non-adjacent named range

Hi all.

I have used Offset with a Named Range before to loop through a named
range, setting the values. However when i try this with a named range
that has non-adjacent columns, I can't get it to work. Here is the
simplest scenario.

If I have a named range made up of the following cells - A1:A9 and
C1:C9, both of the following lines returns the value in A1:

Range("Data").Item(1, 1).Value
Range("Data").Cells(1, 1).Value

If I want to refer to the first row but the second column in the named
range, i would expect either of the following to work:

Range("Data").Item(1, 2).Value
Range("Data").Cells(1, 2).Value

However, both of these return me the value in cell B1 !! Why? Why not
C1? Cell B1 is not even in my named range. Why is column 2 the column
physically to the right of column 1 in the range, rather then being the
second column in my named range?

Can anyone show me how to get to the second column in my named range,
without having to hardcode the number of columns to jump over?
Obviously, i know that

Range("Data").Item(1, 3).Value

will give me the value in cell C1 but that kind of invalidates the
whole point of using a named range - I shouldn't need to know the
structure of the sheet.

Thanks in advance,
Simon Cullen
remove the .nospam

 
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
Named range is hidden when using OFFSET() Conan Kelly Excel Discussion (Misc queries) 1 October 8th 07 08:56 PM
named range row offset [email protected] Excel Worksheet Functions 5 July 8th 06 01:35 AM
Dynamic named range & Offset fastballfreddy Excel Discussion (Misc queries) 1 May 4th 06 09:00 AM
named range, offset self-reference George Excel Discussion (Misc queries) 6 November 6th 05 11:21 PM
named range / offset Gixxer_J_97[_2_] Excel Programming 5 March 11th 05 09:09 PM


All times are GMT +1. The time now is 06:36 AM.

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

About Us

"It's about Microsoft Excel"