CODE AutoFill Destination

Bonjour à tous,

Voici le code que j'ai :

Dim DD As Integer

DD = Cells(Application.Rows.Count, "B").End(xlUp).Row

Range("D4").Select

ActiveCell.FormulaR1C1 = _

"=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)"

Range("D4").AutoFill Destination:=Range("D4:D" & DD), Type:=xlFillDefault

Je veux exécuter la dernière ligne du code que seulement si le nombre de lignes (Rows) du tableau est strictement supérieur à 5.

Que dois je rectifier ?

Merci beaucoup !

Bonjour,

Essaie ainsi :

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    Cells(4, 4).Resize(DD - 3).FormulaR1C1 = _
    "=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)"
End Sub

Bonjour,

Essaie ainsi :

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    Cells(4, 4).Resize(DD - 3).FormulaR1C1 = _
    "=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)"
End Sub

Désolé mais ça ne marche pas. Merci quand même

Re,

Cela veut dire quoi?

Désolé mais ça ne marche pas. Merci quand même

La formule renvoie une valeur d'erreur? la plage est erronée?

Cdlt.

Re,

Cela veut dire quoi?

Désolé mais ça ne marche pas. Merci quand même

La formule renvoie une valeur d'erreur? la plage est erronée?

Cdlt.

Re,

L'étalage de la formule dépasse la plage dans le cas ou mon tableau contient plus que 5 lignes

Re,

Essaie ainsi :

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    If DD > 5 Then
        Cells(4, 4).Resize(DD - 3).FormulaR1C1 = _
        "=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)"
    End If
End Sub

Re,

Essaie ainsi :

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    If DD > 5 Then
        Cells(4, 4).Resize(DD - 3).FormulaR1C1 = _
        "=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),CAPABILITE_3311!R3C3)+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/CAPABILITE_3311!R3C3)"
    End If
End Sub

Merci pour la réponse, sauf que quand j'ai effectué cette modification sur le tableau, je n'ai pas eu eu de résultat dans la cellule désirée (sachant qu'il n'y a pas de bug au macro).

Voici le code après modification :

Range("D3").Select

ActiveCell.FormulaR1C1 = "NBR D'EXEMPLAIRE"

Dim DD As Long

DD = Cells(Rows.Count, 2).End(xlUp).Row

If DD > 5 Then

Cells(4, 4).Resize(DD - 3).FormulaR1C1 = _

"=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Schäfer"",RC[-3])/((CAPABILITE_3311!R6C3)*(CAPABILITE_3311!R6C4)))-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Schäfer"",RC[-3]),((CAPABILITE_3311!R6C3)*(CAPABILITE_3311!R6C4)))>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Schäfer"",RC[-3]),((CAPABILITE_3311!R6C3)*(CAPABILITE_3311!R6C4)))+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Schäfer"",RC[-3])/((CAPABILITE_3311!R6C3)*(CAPABILITE_3311!R6C4)))"

End If

Y-a-t-il une autre rectification ?

Merci

Bonjour,

Que se passe-t-il avec ce code?

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    If DD > 5 Then
        Cells(4, 4).Resize(DD - 3).Value="A"
    End If
End Sub

Bonjour,

Que se passe-t-il avec ce code?

Public Sub XXX()
Dim DD As Long
    DD = Cells(Rows.Count, 2).End(xlUp).Row
    If DD > 5 Then
        Cells(4, 4).Resize(DD - 3).Value="A"
    End If
End Sub

Bonjour,

Je joins les deux fichiers.

Veuillez déplacer le 325 dans le fichier .xlsm

Exécuter la macro ANALYSE_GROUPE puis MINUTES_3311.

Par la suite, éxécuter BMNR-Schäfer.

L'objectif est de faire l'auto fil jusqu'à l'avant dernière ligne.

Merci pour l'aide

2325.xlsx (526.31 Ko)
4vk-planung.xlsm (138.39 Ko)

Re,

Quel est le résultat attendu de la formule?

=LIREDONNEESTABCROISDYNAMIQUE("MIN_PLANNED";A4;"BMNR_Pawomat";A4)

Le champ BMNR_Pawomat correspond à quoi?

Cdlt.

Re,

Quel est le résultat attendu de la formule?

=LIREDONNEESTABCROISDYNAMIQUE("MIN_PLANNED";A4;"BMNR_Pawomat";A4)

Le champ BMNR_Pawomat correspond à quoi?

Cdlt.

C'est un champ qui résulte du macro ANALYSE_GROUPE

Re,

Et on le retrouve ou dans le TCD?

Peux-tu réécrire ta formule manuellement?

Cdlt.

Re,

Et on le retrouve ou dans le TCD?

Peux-tu réécrire ta formule manuellement?

Cdlt.

La voilà

=SI(Z17="Pawomat";J17;0)

Re,

Je ne comprends rien!...

Quelle est la relation de ta formule avec la formule LIREDONNEESTABCROISDYNAMIQUE initiale?

Cdlt.

Bonjour,

Voici la solution que j'ai pu trouvé :

Range("D3").Select

ActiveCell.FormulaR1C1 = "NBR D'EXEMPLAIRE"

Dim DD As Integer

DD = Cells(Application.Rows.Count, "B").End(xlUp).Row

Range("D4").Select

ActiveCell.FormulaR1C1 = _

"=IF((GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/((CAPABILITE_3311!R3C3)*(CAPABILITE_3311!R3C4)))-QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),((CAPABILITE_3311!R3C3)*(CAPABILITE_3311!R3C4)))>0,QUOTIENT(GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3]),((CAPABILITE_3311!R3C3)*(CAPABILITE_3311!R3C4)))+1,GETPIVOTDATA(""MIN_PLANNED"",RC[-3],""BMNR_Pawomat"",RC[-3])/((CAPABILITE_3311!R3C3)*(CAPABILITE_3311!R3C4)))"

If DD > 5 Then

Range("D4").AutoFill Destination:=Range("D4:D" & DD - 1), Type:=xlFillDefault

Else

Range("F10").Select

End If

Merci à tous pour votre aide et particulièrement à Jean

Rechercher des sujets similaires à "code autofill destination"