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
| Sub remplir()
Dim nom As String, note As String, dern As Date, prem As Date
Dim ligne As Long, colDer As Long, colPrem As Long, colDebut As Long, colFin As Long
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(nome).Row 'ça marche !
With ActiveSheet.Range("caleDate")
Set colDer = .Find(dern, LookIn:=xlValues).Column ' ça bloque! Run-time 91
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"
Exit Sub
Else
MsgBox "trouvé: " And colDer
Exit Sub
End If
' ensuite il faudra mettre ces données dans le tableau
End With
End If
Next
End Sub |
Partager