Question about working with range array

  • Thread starter Thread starter 39N 95W
  • Start date Start date
3

39N 95W

Excel 2002
Windows XP Pro SP2

I have an array that is filled with range objects. The range extents are
rows of data, from A to M and from many different row numbers. How do I
access a particular cell value within a range object? For instance:

i = 0
For Each cell in myRange.Cells
If cell.Offset(0, 2).Value <> cell.Offset(0,5 ).Value Then
i = i + 1
Set NewRng(i) = Range(cell, cell.Offset(0, 12))
End If
Next cell

'Now loop through NewRng and evaluate the cell value in the 4th column of
NewRng

For i = 1 to TotRngs
Msgbox NewRng(i).????.Address 'what should I put in place of ????
Next i

Any and all help appreciated.

-gk-


========================================================================
"The creative act is not the province of remote oracles or rarefied
geniuses but a transparent process that is open to everyone."
-Greg Kot in Wilco Learning How To Die-
 
Hello GK,

To get the 4th column's address for each NewRng, do this...

For i = 1 to TotRngs
Msgbox NewRng(i).Cells(1, 4).Address
Next i

Sincerely,
Leith Ross
 
Something like this, so use Cells:

Sub test()

Dim i As Byte
Dim arr(1 To 10) As Range

For i = 1 To 10
Set arr(i) = Range(Cells(i, 1), Cells(i, 5))
Next

For i = 1 To 5
MsgBox arr(i).Cells(i)
Next

End Sub


RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top