Help with a Loop please
Kamal,
Can you please repost Function FindValueExists as my newsreader appears only
to have the first line
Thanks
Martin
Kamal wrote in message ...
You can add few changes to the for loop and pass the excel sheet to the
method FindValueExists(sheet, val, indexOnDestSheet) might help you.
"Martin" wrote in message
...
Kamal,
Thanks for responding so quickly, but I obviously didn't explain
accurately
enough. The results contained in e2:e48 need to be matched to values in
the
first workbook. The results contained in e50:e97, may be the same results
numerically as e2:e48, but these need to be matched to a different set of
values in the second workbook.
Am I missing something or should there be more to the function?
Thanks
Martin
Kamal wrote in message ...
Hi,
I am not sure whether the solution exactly works for you. You can
define
a
named range on the 384 results by
Range(Cells(10,1),Cells(384,1)).name = "MyRange"
rngCount = Range("MyRange").Rows.count
J = 1
' Loop through the entire range. and the Named Range will take care of
the
address of the cell.
For I = 1 to rngCount
val = Range("MyRange).Cells(I,col). value
If FindValueExists(val) then ' check whether it exists in another
sheet
Range("MyRange").Rows(I).copy
Destination:=Worksheets(index).Cells(J,6)
J = J + 1
End If
Next
Function FindValueExists(val as Integer) as boolean ' This method will
match
the given integer value against the 8 values in other workbook
regards
Kamal
|