samedi 20 février 2021

VBA Macro not working with specific time constraints

Public Sub master()
Dim checker As Date

     checker = Time
     If (checker > TimeValue("09:15:00")) & (checker <= TimeValue("12:00:00")) Then
         MsgBox "On time"

    Else
         MsgBox "Not the right time"
    End If

End Sub

It is giving an error on the if statement "Typer Mismatch" Run Time error 13, I have also tried Now, checker = Now Wasn't able to find any solution so this is my last option. Any help would be appreciated Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire