Sub Planning_horaire()
Dim heure1 As String
Dim heure2 As String
Dim heure3 As String
Dim heure4 As String
Dim F1 As String
Dim F2 As String
F1 = Sheets("Planning").Name
F2 = Sheets("Planning_horaire").Name
For x1 = 8 To 94 'dans la feuille F1
For x2 = 4 To 24 'dans la feuille F2
  If Sheets(F1).Range("A" & x1) = Sheets(F2).Range("R1") Then
  If Sheets(F1).Range("BB" & x1) <> 0 Then
Sheets(F1).Select
Cells(x1, 2).Select
Selection.End(xlToRight).Select
    ActiveCell.Select
    y1 = ActiveCell.Column
  heure1 = Format(Cells(5, y1), "hh:mm")
          ActiveCell.Offset(0, 1).Select
    Selection.End(xlToRight).Select
    ActiveCell.Select
        y2 = ActiveCell.Column
    heure2 = Format(Cells(5, y2), "hh:mm")
     ActiveCell.Offset(0, 1).Select
    Selection.End(xlToRight).Select
    ActiveCell.Select
       y3 = ActiveCell.Column
   heure3 = Format(Cells(5, y3), "hh:mm")
    Selection.End(xlToRight).Select
       y4 = ActiveCell.Column
   heure4 = Format(Cells(5, y4), "hh:mm")
      If Sheets(F2).Range("B" & x2) = Sheets(F2).Range("R1") Then
    Sheets(F2).Select
    Sheets(F2).Cells(x2, 1).Select
ActiveSheet.Range("I" & ActiveCell.Row).End(xlToLeft).Offset(0, 1).Select
  ActiveCell = heure1 & "-" & heure2
ActiveCell = ActiveCell.Offset(1, 0).Select
ActiveCell = heure3 & "-" & heure4
    x1 = x1 + 1
End If
End If
End If
Next
Next
End Sub