Voici, j'ai 2 tableaux.
Celui sur lequel je travaille ressemble à ça.
Je vais chercher des données dans un autre tableau qui est un TCD. Cette partie fonctionne mais ça ne s'incrémente pas.
Je ne suis pas développeur. Cet outil et un plan projet qui ressemble à un plan de charge mais le point d'entrée est l'action, le projet et non la personne.
Quelqu'un peut il m'aider, en plus je dois finir ça pour cet aprem et j'en ai fait des tonnes et là je ne c plus quoi faire. Je vous montre la dernière version.
Merci par avance de votre aide.
Michel
colonneA____Action_______Nom______Tache______Mois1______Mois2.....
Tache______Mois1______Mois2.....
TotalTache______Mois1______Mois2.....
TotalNom_______________Mois1______Mois2.....
Total_action______________________Mois1______Mois2......
colonneA____
Sub MiseAJour()
'
' Macro de Mise à Jour du tableau
'
Dim Début As Integer
Dim Fin As Integer
Dim a1 As Integer
Dim action As String
Dim a0 As Integer
Dim a0Fin As Integer
Dim a2 As Integer
Dim Total_action As Integer
Dim personne As String
Dim Total_personne As String
Dim ligne_personne As Integer
Dim ligne_Total As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Sheets("PlanProjet" ).Select
Début = Sheets("PlanProjet" ).Columns("A:A" ).Find(what:="*Début*", LookAt:=xlWhole).Row
Sheets("PlanProjet" ).Select
Fin = Sheets("PlanProjet" ).Columns("A:A" ).Find(what:="*Fin*", LookAt:=xlWhole).Row
Sheets("PlanProjet" ).Select
For l = Début To Fin
'If Range("B" & l).Value = "" Or Sheets("PlanProjet" ).Range("B" & l).Value Like ("*Total*" ) Then
'l = l + 1
'Else
Do While Range("B" & l).Value = "" Or Sheets("PlanProjet" ).Range("B" & l).Value Like ("*Total*" )
l = l + 1
If l >= Fin Then
Exit For
End If
Loop
'Si ligne action vide alors passe à la ligne suivante et ainsi de suite jusqu'à trouver une action
action = Sheets("PlanProjet" ).Range(Cells(l, 2), Cells(Fin - 1, 2)).Find(what:=Range("B" & l).Value, LookAt:=xlWhole)
' Récupération du nom (valeur) de la 1° action
'action = Sheets("PlanProjet" ).Range("B" & l).Value
ligne_action = Sheets("PlanProjet" ).Range(Cells(l, 2), Cells(Fin - 1, 2)).Find(what:=Range("B" & l).Value, LookAt:=xlWhole).Row
' Définition du total du nom (valeur) de la 1° action
Total_action = Sheets("PlanProjet" ).Range(Cells(l, 2), Cells(Fin - 1, 2)).Find(what:="*Total*" & action, LookAt:=xlWhole).Row
For j = ligne_action To Total_action
Do While Range("B" & l).Value = "" Or Sheets("PlanProjet" ).Range("B" & l).Value Like ("*Total*" )
l = l + 1
If l >= Fin Then
Exit For
End If
Loop
'Si ligne pingouin vide alors passe à la ligne suivante et ainsi de suite jusqu'à trouver un pingouin
'If Range("D" & j).Value = "" Or Sheets("PlanProjet" ).Range("D" & j).Value Like ("*Total*" ) Then
'j = j + 1
'Else
ligne_Total = Sheets("PlanProjet" ).Range(Cells(j, 4), Cells(Total_action, 4)).Find(what:="*Total*" ).Row
For h = j To ligne_Total
personne = ""
Do While Range("D" & h).Value = "" Or Sheets("PlanProjet" ).Range("D" & h).Value Like ("*Total*" )
h = h + 1
If h >= ligne_Total_personne Then
Exit For
End If
Loop
' Récupération du nom (valeur) du 1° Pingouin
personne = Sheets("PlanProjet" ).Range("D" & h).Value
ligne_personne = Sheets("PlanProjet" ).Range(Cells(h, 4), Cells(Total_action, 4)).Find(what:=Range("D" & h).Value).Row
' Définition du total du nom (valeur) du 1° Pingouin
ligne_Total_personne = Sheets("PlanProjet" ).Range(Cells(h, 4), Cells(Total_action, 4)).Find(what:="*Total*" & personne).Row
'Dans le tableau croisé dynamique on va chercher ces mêmes valeurs
Sheets("TCDPLC" ).Activate
a0 = Sheets("TCDPLC" ).Columns("A:A" ).Find(what:=action, LookAt:=xlWhole).Row
a0Fin = Sheets("TCDPLC" ).Columns("A:A" ).Find(what:="*Total*" & action, LookAt:=xlWhole).Row
a2 = Sheets("TCDPLC" ).Rows("4:4" ).Find(what:="*Total*", LookAt:=xlWhole).Column
a1 = Sheets("TCDPLC" ).Range("C" & a0, "C" & a0Fin).Find(what:="*" & personne & "*" ).Row
'Copie des données dans le Plan de charge
Sheets("TCDPLC" ).Range("D" & a1, "O" & a1).Copy _
Destination:=Sheets("PlanProjet" ).Range("F" & ligne_Total_personne)
Columns("A:A" ).EntireColumn.AutoFit
Application.CutCopyMode = False
'Sheets("PlanProjet" ).Select
'j = ligne_Total_personne
'h = ligne_Total + 1
'ligne_Total = Sheets("PlanProjet" ).Range(Cells(h, 4), Cells(Total_action, 4)).Find(what:="*Total*" ).Row
Next
' ligne_Total = Sheets("PlanProjet" ).Range(Cells(h, 4), Cells(Total_action, 4)).Find(what:="*Total*" ).Row
Next
'End If
'If j > Fin Then
'Exit Sub
'End If
Next
End Sub