![]() |
Question about working with range array
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- |
Question about working with range array
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 -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=502703 |
Question about working with range array
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 "39N 95W" wrote in message ... 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- |
All times are GMT +1. The time now is 01:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com