![]() |
Traversing two named rages of unequal length
I created a function with help from this forum that allows you t
traverse an autofilter range. With this function i created two ranges of unqeual length from th autofilter ranges in two seperate workbooks. My questions is this. How can i traverse through both of these range at the same time using the format for each rng in FilteredRange1 if rng in FilteredRange2 = value then 'do this end if next rng thank -- Message posted from http://www.ExcelForum.com |
Traversing two named rages of unequal length
if the ranges are of unequal length, then why would the sequence in each be
a valid test. in any event i = 0 for each rng in FilterRange1 i = i +1 for each rng1 in FilterRange2 j = j + 1 if j = i then if rng1 = value then 'do this exit for end if end if Next Next -- Regards, Tom Ogilvy "zestpt " wrote in message ... I created a function with help from this forum that allows you to traverse an autofilter range. With this function i created two ranges of unqeual length from the autofilter ranges in two seperate workbooks. My questions is this. How can i traverse through both of these ranges at the same time using the format for each rng in FilteredRange1 if rng in FilteredRange2 = value then 'do this end if next rng thanks --- Message posted from http://www.ExcelForum.com/ |
Traversing two named rages of unequal length
thanks tom, but even if they were of equal length. is there anyway t
traverse through the ranges without using counters? For example i wan this code below to work without using a counter or nested for loops. 'Traverse range and put in value For Each rng In PCR_AMTRange 'start populating, bypasses the header and don't populate pas the range count If rng < "PCR_AMT" And counter ObjSpreadSheetC.Range(IndexRangeName(r)).Count + 1 Then ObjSpreadSheetC.Range(IndexRangeName(r))(counter) = rng End If counter = counter + 1 Next rn -- Message posted from http://www.ExcelForum.com |
Traversing two named rages of unequal length
There is no way to use a single for each construct on two separate ranges
where both ranges include multiple areas. -- Regards, Tom Ogilvy "zestpt " wrote in message ... thanks tom, but even if they were of equal length. is there anyway to traverse through the ranges without using counters? For example i want this code below to work without using a counter or nested for loops. 'Traverse range and put in value For Each rng In PCR_AMTRange 'start populating, bypasses the header and don't populate past the range count If rng < "PCR_AMT" And counter < ObjSpreadSheetC.Range(IndexRangeName(r)).Count + 1 Then ObjSpreadSheetC.Range(IndexRangeName(r))(counter) = rng End If counter = counter + 1 Next rng --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 04:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com