Hi everyone, i wrote a code for a workbook that have two worksheet´s, in the ProximoPedido (sheet) in column "A" there is a range of a values (integer number) and in colunm "B" there is a date associated, and in the ChekingList (sheet) there is the colunm "A" with the values (wich must match with "A" of ProximoPedido) and colunm "E" with dates. If value of cell A of CheckingList matches with value of "A" of ProximoPedido then search in "E" of ChekingList for next ( or closest higher) date of "B" from ProximoPedido.

Sheet: ChekingList


A E

1 2009-10-30 12:00
3 2009-10-29 13:00
2 2009-10-29 12:20
50 2009-10-19 10:20
24 2009-10-28 10:20
3 2009-10-28 10:20

Sheet: Proximo Pedido

A B

4 2009-10-28 10:20
20 2009-10-29 13:00
3 2009-10-19 15:20
24 2009-10-29 13:40
3 2009-10-27 13:20

i wrote a formula first with conditioning VLOOKUP and other with INDEX MATCH, but the VLOOKUP gave me the last value of all dates in CheckingList, and then i tried this code :
Sub TempoTotal1()

Please Login or Register  to view this content.
Thanks