(Solved) – How to make a loop between a fixed date “hh:ss” and a range of cells


First, I am sorry if there are huge erros in my code, I am just starting. I was wondering how to compare the date “hh:ss” cell Z4 with a range with the same format (AB4:AB19). If it finds the value Z4 in the code, i will like to add 2 minutes and look again, if it does not find the value get out of the code and settle that value in the cell AB4. Thanks for the help, there is my code.

Sub CompTSAT1()

    Dim VALTSAT1 As Date
    VALSAT1 = Z4

    Do While VALSAT1 = Range("AB4:AB19")
        VALSAT1 = DateAdd(n, 2, VALSAT1)

        Exit Do

        AB4 = VALSAT1

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *