1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Sub TodyBlue()
Dim mon_activité As String
Dim ma_tache As String
Dim ma_plus_petite_date As Variant
Dim ma_ligne As Variant
mon_activité = InputBox("activité ?", "Tapez l'activité")
ma_tache = InputBox("tache ?", "Tapez la tâche")
ma_plus_petite_date = 99999 'j'ai mis une date sur l'année 2173 pour commencer
Dim oList As ListObject
Dim oRow As ListRow
Set oList = ActiveSheet.ListObjects("TBL_Données")
For Each oRow In oList.ListRows
If oRow.Range(1) = mon_activité And oRow.Range(2) = ma_tache Then
If oRow.Range(4).Value < ma_plus_petite_date Then
ma_plus_petite_date = oRow.Range(4).Value
ma_ligne = oRow.Range(4).Row
End If
End If
Next oRow
'je copie ma ligne dans la feuile 2
Sheets("Feuil2").Rows("4:4").Value = Sheets("Feuil1").Rows(ma_ligne & ":" & ma_ligne).Value
End Sub |
Partager