View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Match Ranges problem ,

You have this loop for range1...

For Each cell1 In range1
Set cell2 = cell1.Offset(0, myOffset)
If cell1.Value = cell2.Value Then cell2.Value = "QQQ"
Next

Just put this loop for range2 immediately following it in your code...

For Each cell1 In range2
Set cell2 = cell1.Offset(0, myOffset)
If cell1.Value = cell2.Value Then cell2.Value = "QQQ"
Next

Of course, I'm assuming you want to assign "QQQ" to the cells located at the
same offset distance (the myOffset variable) from range2's cells as you did
for range1's cells.

--
Rick (MVP - Excel)


"ytayta555" wrote in message
...
On 2 mar., 21:39, "Rick Rothstein"
wrote:
You could always run two separate "For Each" loops... one for range1 and
the
second one for range2.


Maybe for the programmers is very easy , but I really don't know
how ..