Modification Macro

Bonjour à toutes et à tous,

J'aimerais modifier le code de ma Macro en Feuille Caldendrier final pour réaliser l'action suivante :

- rechercher dans la feuille 2023 les données correspondant au nom de l'agent en colonne F ET à la période indiquée en colonne E.

J'ai apporté certaines modifications déjà mais j'ai du mal à ajouter cette fonctionnalité (critère manquant > la période).

Quelqu'un pourrait-il m'indiquer comment faire ?

Private Sub Worksheet_Change(ByVal Target As Range)

  If Application.Intersect(Target, Range("B4")) Is Nothing Then Exit Sub
  Dim coldeb As Integer, i As Integer, j As Integer, c As Range, madate As Date, lig As Long
  Range("J7:AN132").ClearContents
  madate = DateValue("1 " & Range("B3").Value & " " & Range("B2").Value)
  With Sheets("2023")
    If .Range("E2").Value <> Range("B2").Value Then
      MsgBox ("La feuille " & Range("B2").Value & " n'existe pas")
      Exit Sub
    End If
   coldeb = 6 + madate - .Range("F5").Value
   For i = 6 To .Range("E" & Rows.Count).End(xlUp).Row
     For j = coldeb To coldeb + 31
       If .Cells(i, j).Value <> "" Then
         Set c = Columns(7).Find(.Cells(i, 5).Value, LookIn:=xlValues)
         If Not c Is Nothing Then
           Cells(c.Row, 10 + j - coldeb).Value = .Cells(i, j).Value
         Else
           lig = Range("G" & Rows.Count).End(xlUp).Row + 2
           Range("B" & lig).Value = .Range("B" & i).Value
           Range("D" & lig).Value = .Range("C" & i).Value
           Range("F" & lig).Value = .Range("D" & i).Value
           Range("G" & lig).Value = .Cells(i, 5).Value
           Cells(lig, 10 + j - coldeb).Value = .Cells(i, j).Value
         End If
       End If
     Next
   Next
  End With
End Sub

Bonjour,

Merci de clôturer les sujets avant d'en ouvrir d'autre SVP

Bonjour,

C'est fait merci :)

Rechercher des sujets similaires à "modification macro"