Hi

I have the following code that loops through data to check what mileage each vehicle has done between "Current Month" and "Last Month".

The code uses WorksheetFunction.Vlookup to compare vehicle registrations for current & last months and their corresponding mileage readings.

Finally, the mileage readings difference between current month and last month is placed in column 12 of current month to give the mileage done in current month.

The code works fine but takes about 7 seconds to complete its trawl through about 300 rows of data.

As the list is likely to increase in future, I was wondering if there is a quicker way to loop?

Any advice would be greatly appreciated.

Thanks

On Error Resume Next
    Table1 = Sheets("Last Month Data").Range("A2:K" & LastRow1)
    Table2 = Sheets("Current Month Data").Range("A2:K" & LastRow2)
        Mileage_Row = 2
        Mileage_Col = 12
    
        For Each cl In Table2
            Sheets("Current Month Data").Cells(Mileage_Row, Mileage_Col) = Sheets("Current Month Data").Cells(Mileage_Row, Mileage_Col - 10) _
            - Application.WorksheetFunction.VLookup(cl, Table1, 2, False)
            Mileage_Row = Mileage_Row + 1
        Next