Re : Problème de code/macro
Bonjour soenda, le forum,
désolé pour ma réponse tardive, j'ai eu quelques soucis de santé et je me suis un peu éloigné de mon ordi et de ce casse-tête.
Alors voici ce que j'obtiens du débogueur:
"Erreur d'exécution 91 - variable d'objet ou variable de blocs non définie"
Et c'est cette ligne qui est en jaune: "PremLig = .Columns("A:A").Find(What:="Sce", LookAt:=xlWhole).Row + 1"
Et dans mon tableau de synthèse, tout est encore une fois décalé ...
Quelqu'un a une idée?
Merci d'avance à tous et bon dimanche.
PS: voici mon code actuel:
Sub totaux()
Dim tablo As Variant
Dim i As Long, j As Byte, k As Long, s As Byte
Dim PremLig As Long, DerLig As Long, DerLig2 As Long
For Each V In Array("Décès", "Standard", "Non-Standard", "Totaux")
With Sheets(v)
PremLig = .Columns("A:A").Find(What:="Sce", LookAt:=xlWhole).Row + 1
DerLig = .Columns("A:F").Find(What:="Remplaçants", LookAt:=xlWhole).Row - 1
DerLig2 = .Columns("A:A").Find(What:="Total", LookAt:=xlWhole).Row - 2
tablo = .Range(.Cells(PremLig, 1), .Cells(DerLig, 32))
For i = DerLig + 2 To DerLig2 Step 2
For j = 5 To 31
If .Cells(i, j) <> "" Then
For k = 1 To UBound(tablo)
If tablo(k, 1) = .Cells(i, j) Then
tablo(k, UBound(tablo, 2)) = tablo(k, UBound(tablo, 2)) + .Cells(i + 1, j)
End If
Next k
End If
Next j
Next i
For i = 1 To UBound(tablo)
Sheets("Totaux").Cells(i + 2, s + 10) = tablo(i, UBound(tablo, 2))
Next i
Erase tablo
End With
Next v
End Sub