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: 6
Default Iterate over irregular shaped range problem

I have set up a number of named ranges - each of which is an irregular
shape (as in not rectangular).

I have found that one can iterate through all cells in a rectangular
range with a loop like:

' Set all cells in named range to contain 'hello'
set ws = Sheets("aWorksheet")
For i = 1 To ws.Range("aRegularRange").Count
ws.Range("aRegularRange").Cells(i).Value = "hello"
Next i

BUT...

When I try to do the same with a non-rectangular range, it simply
moves down the first column in the range and keeps going downwards and
out of the range.

Is there a way round this? Is the Values property not supposed to be
used with just one argument? Is there a way of iterating through an
irregular range by specifying a single index value?

N.B - I can't use a 'For Each' as I want to jump through the cells in
regular intervals.

Thanks

Mark
 
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
Iterate over a Range of data - create arrays or ranges eholz1 Excel Programming 3 January 30th 08 05:50 PM
Pulling "Irregular Shaped" Data from Excel Alden Excel Programming 1 October 28th 07 10:49 PM
How To Iterate a range of cells? StarGazerNC Excel Programming 5 August 4th 04 04:51 PM
Iterate through the values in a named range? Brian Excel Programming 1 June 2nd 04 05:04 AM


All times are GMT +1. The time now is 08:47 AM.

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"