Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



Reply
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
traversing a filtered range (excel 2007) parahumanoid Charts and Charting in Excel 3 November 2nd 09 08:11 PM
Series with noncontiguous unequal length data? [email protected] Charts and Charting in Excel 3 June 15th 06 06:23 PM
unequal sign et Excel Discussion (Misc queries) 2 February 6th 05 11:17 PM
Unequal Sign et Excel Discussion (Misc queries) 1 February 5th 05 04:30 AM
Traversing Rows Tom Ogilvy Excel Programming 0 August 20th 03 05:10 PM


All times are GMT +1. The time now is 10:24 PM.

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"