Sheet display in function of date and time on open and save
selectiondequartauto() defines night shift to determine whether to select either the night shift or day shift sheet.  If none of the worksheets meet the criteria of Night Shift or Day Shift then the Friday worksheet is selected.  This all works fine but consider the advantages of my refactored code which separates these tasks into their own methods.
• isNightShift: Using a function that determines what is Night Shift and what is Day Shift means that you can update the hours of Night Shift in one spot and not have to look over every procedure that is dependent on on the Night Shift.
• NightShiftSheet() and DayShiftSheet():  Having these functions will prevent you from having to repeat the logic to find the sheets in the future.  They also make  selectiondequartauto() easier to read
Public Sub selectiondequartauto()
    Dim ws As Worksheet
    
    If isNightShift(Now) Then
        Set ws = NightShiftSheet
    Else
        Set ws = DayShiftSheet
    End If
    
    If ws Is Nothing Then
        Sheets(&quot;Vendredi jour&quot;).Activate
    Else
        ws.Activate
    End If
End Sub

Public Function DayShiftSheet() As Worksheet
    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Worksheets
        With ws.Range(&quot;B4&quot;)
            If IsDate(.Value) Then
                If Not isNightShift(.Value) Then
                    Set DayShiftSheet = ws
                    Exit Function
                End If
            End If
        End With
    Next
    
End Function

Public Function NightShiftSheet() As Worksheet
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
        With ws.Range(&quot;B4&quot;)
            If IsDate(.Value) Then
                If isNightShift(.Value) Then
                    Set NightShiftSheet = ws
                    Exit Function
                End If
            End If
        End With
    Next
End Function

Public Function isNightShift(DateTime As Date) As Boolean
    isNightShift = TimeValue(DateTime) &gt; TimeValue(&quot;3:00:00&quot;) And TimeValue(DateTime) &lt; TimeValue(&quot;16:15:00&quot;)
End Function