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 29 30 31 32 33 34 35 36 37 38
| Sub remplir()
Dim nom As String, note As String, dern As Date, prem As Date
Dim ligne As Long, colDer As Range, colPrem As Range, colDebut As Range, colFin As Range
NrRgLista = Range("lista").Rows.Count
For i = 2 To NrRgLista 'la 1ère ligne contient des noms de champs
With Range("lista").Rows(i)
nom = .Cells(1).Value
dern = .Cells(2).Value
prem = .Cells(3).Value
note = .Cells(4).Value
iniCong = dern + 1
finCong = prem - 1
End With
If nom <> "" Then
ligne = Range("caleNomi").Find(nom).Row 'ok, ça marche comme avant
With ActiveSheet.Range("caleDate")
Set colDer = .Find(dern, LookIn:=xlValues) '.Column ' ça ne marche plus
Set colPrem = .Find(prem, LookIn:=xlValues) '.Column
Set colDebut = .Find(iniCong, LookIn:=xlValues) '.Column
Set colFin = .Find(finCong, LookIn:=xlValues) '.Column
If colDer Is Nothing And colPrem Is Nothing Then
MsgBox "date dernier jour hors calendrier - " & nom & " " & ligne
Exit Sub
Else
MsgBox "trouvé: " And colDer.Column
Exit Sub
End If
' ensuite il faudra mettre ces données dans le tableau
End With
End If
Next
End Sub |
Partager