Re : Incrémentation d'un onglet Récap
Bonjour Fab,
Je suis désolé de t'embêter encore, mais il me reste encore qques soucis :
- Colonne O à R de recap : (retenuemontant; retenuedaterest; montantdeclare; montantfacture ) il me retourne la formule des cellules de Worksheets au lieu de me retourner les valeurs
- Colonne S de recap (ecart) : je voudrais faire apparaitre la différence entre la cellule B41 et S41 de Worksheets
Si tu as le tps de jetter un oeil ce serait très sympa
Merci
Private Sub Worksheet_Activate()
Dim Z As Integer
Dim condu As Range
Dim num
'supprime le tableau existant
Range("A6", Range("U6").End(xlDown)).Delete
'boucle sur toutes les feuilles à partir de la troisiéme
For Z = 3 To Sheets.Count
'tu nomme ici toutes les destinations de copies : condu, numéro affaire,libéllé affaire,...
Set condu = Sheets("recap").Range("A65536").End(xlUp).Offset(1, 0)
Set numaffaire = Sheets("recap").Range("B65536").End(xlUp).Offset(1, 0)
Set libelleaffaire = Sheets("recap").Range("C65536").End(xlUp).Offset(1, 0)
Set fournisseur = Sheets("recap").Range("D65536").End(xlUp).Offset(1, 0)
Set naturetvx = Sheets("recap").Range("E65536").End(xlUp).Offset(1, 0)
Set retourcontrat = Sheets("recap").Range("F65536").End(xlUp).Offset(1, 0)
Set cautionafournir1 = Sheets("recap").Range("G65536").End(xlUp).Offset(1, 0)
Set cautionafournir2 = Sheets("recap").Range("H65536").End(xlUp).Offset(1, 0)
Set cautionafournir3 = Sheets("recap").Range("I65536").End(xlUp).Offset(1, 0)
Set cautionafournir4 = Sheets("recap").Range("J65536").End(xlUp).Offset(1, 0)
Set cautionretenue1 = Sheets("recap").Range("K65536").End(xlUp).Offset(1, 0)
Set cautionretenue2 = Sheets("recap").Range("L65536").End(xlUp).Offset(1, 0)
Set cautionretenue3 = Sheets("recap").Range("M65536").End(xlUp).Offset(1, 0)
Set retenue = Sheets("recap").Range("N65536").End(xlUp).Offset(1, 0)
Set retenuemontant = Sheets("recap").Range("O65536").End(xlUp).Offset(1, 0)
Set retenuedaterest = Sheets("recap").Range("P65536").End(xlUp).Offset(1, 0)
Set montantdeclare = Sheets("recap").Range("Q65536").End(xlUp).Offset(1, 0)
Set montantfacture = Sheets("recap").Range("R65536").End(xlUp).Offset(1, 0)
Set ecart = Sheets("recap").Range("S65536").End(xlUp).Offset(1, 0)
Set avenant = Sheets("recap").Range("T65536").End(xlUp).Offset(1, 0)
Set pvreception = Sheets("recap").Range("U65536").End(xlUp).Offset(1, 0)
'là tu vas chercher la cellule à copier
Worksheets(Z).Range("E11").Copy condu
Worksheets(Z).Range("E9").Copy numaffaire
Worksheets(Z).Range("E10").Copy libelleaffaire
Worksheets(Z).Range("E5").Copy fournisseur
Worksheets(Z).Range("E6").Copy naturetvx
If Worksheets(Z).Range("C22").Value = "X" Then
retourcontrat.Value = "O"
Else: retourcontrat.Value = "N"
End If
If Worksheets(Z).Range("F22").Value = "PR" Then
cautionafournir1.Value = "O"
Else: cautionafournir1.Value = "N"
End If
If Worksheets(Z).Range("J22").Value > 0 Then
cautionafournir2.Value = "Fait"
Else: cautionafournir2.Value = "Pas fait"
End If
If Worksheets(Z).Range("L22").Value > 0 Then
cautionafournir3.Value = "O"
Else: cautionafournir3.Value = "N"
End If
If Worksheets(Z).Range("L22").Value <> "" Then
Worksheets(Z).Range("L22").Copy cautionafournir4
End If
If Worksheets(Z).Range("N22").Value = "X" Then
cautionretenue1.Value = "N"
Else: cautionretenue1.Value = "O"
End If
If Worksheets(Z).Range("P22").Value > 0 Then
cautionretenue2.Value = "O"
Else: cautionretenue2.Value = "N"
End If
If Worksheets(Z).Range("P22").Value <> "" Then
Worksheets(Z).Range("P22").Copy cautionretenue3
End If
If Worksheets(Z).Range("T41").Value > 0 Then
retenue.Value = "O"
Else: retenue.Value = "N"
End If
'erreurs à partir d'ici car recopie la formule de la cellule
Worksheets(Z).Range("T41").Copy retenuemontant
If Worksheets(Z).Range("T41").Value <> "" Then
Worksheets(Z).Range("W22").Copy retenuedaterest
End If
Worksheets(Z).Range("B41").Copy montantdeclare
Worksheets(Z).Range("S41").Copy montantfacture
'fin des erreurs
If Worksheets(Z).Range("S41").Value > ("B41") Then
avenant.Value = "O"
Else: avenant.Value = "N"
End If
If Worksheets(Z).Range("E14").Value <> 0 Then
pvreception.Value = "O"
Else: pvreception.Value = "N"
End If
Next Z
'là c'est pour supprimer le format de la cellule
Worksheets("recap").Range(Cells(65536, 1).End(xlUp), "U6").Select
Selection.Font.Bold = False
Selection.Font.ColorIndex = 1
Selection.Borders.Weight = xlThin
Selection.Interior.ColorIndex = xlNone
Selection.HorizontalAlignment = xlCenter
Range("A1").Select
End Sub