Pb Argument non facultatif

Bonjour à tous,

J'ai un souci dans mon programme qui à l'exécution de celui-ci mon dit : Argument non facultatif.

Le but du programme est de classé des noms de clients par groupe en fonction de certains attributs.

Voici le code :

Sub Bouton2_Cliquer()

Dim PPM As Long, NB_FNC As Integer, QSC As Double, CA As Long
Dim i As Integer, j As Integer
Dim DernLigne As Long

    With Worksheets("Feuil1")

        For i = 2 To 138

                PPM = .Cells(i, "S")
                NB_FNC = .Cells(i, "T")
                QSC = .Cells(i, "U")
                CA = .Cells(i, "V")

                'Groupe 8
                If NB_FNC = 1 And PPM < 20000 And QSC > 0.85 Then

                    .Cells(i, "BN") = .Cells(i, "O")
                    .Cells(i, "BN").Interior.Color = RGB(0 / 176 / 80)
                    .Cells(i, "BO") = .Cells(i, "S")
                    .Cells(i, "BO").Interior.Color = RGB(0 / 176 / 80)
                    .Cells(i, "BP") = .Cells(i, "T")
                    .Cells(i, "BP").Interior.Color = RGB(0 / 176 / 80)
                    .Cells(i, "BQ") = .Cells(i, "U")
                    .Cells(i, "BQ").Interior.Color = RGB(0 / 176 / 80)
                    .Cells(i, "BR") = .Cells(i, "V")
                    .Cells(i, "BR").Interior.Color = RGB(0 / 176 / 80)

                'Groupe 7
                ElseIf NB_FNC = 1 And PPM < 20000 And QSC < 0.85 Then

                    .Cells(i, "BH") = .Cells(i, "O")
                    .Cells(i, "BH").Interior.Color = RGB(196 / 215 / 155)
                    .Cells(i, "BI") = .Cells(i, "S")
                    .Cells(i, "BI").Interior.Color = RGB(196 / 215 / 155)
                    .Cells(i, "BJ") = .Cells(i, "T")
                    .Cells(i, "BJ").Interior.Color = RGB(196 / 215 / 155)
                    .Cells(i, "BK") = .Cells(i, "U")
                    .Cells(i, "BK").Interior.Color = RGB(196 / 215 / 155)
                    .Cells(i, "BL") = .Cells(i, "V")
                    .Cells(i, "BL").Interior.Color = RGB(196 / 215 / 155)

                'Groupe 6
                ElseIf NB_FNC = 1 And PPM > 20000 And QSC > 0.85 Then

                    .Cells(i, "BB") = .Cells(i, "O")
                    .Cells(i, "BB").Interior.Color = RGB(216 / 228 / 188)
                    .Cells(i, "BC") = .Cells(i, "S")
                    .Cells(i, "BC").Interior.Color = RGB(216 / 228 / 188)
                    .Cells(i, "BD") = .Cells(i, "T")
                    .Cells(i, "BD").Interior.Color = RGB(216 / 228 / 188)
                    .Cells(i, "BE") = .Cells(i, "U")
                    .Cells(i, "BE").Interior.Color = RGB(216 / 228 / 188)
                    .Cells(i, "BF") = .Cells(i, "V")
                    .Cells(i, "BF").Interior.Color = RGB(216 / 228 / 188)

                'Groupe 5
                ElseIf NB_FNC = 1 And PPM > 20000 And QSC < 0.85 Then

                    .Cells(i, "AV") = .Cells(i, "O")
                    .Cells(i, "AV").Interior.Color = RGB(235 / 241 / 222)
                    .Cells(i, "AW") = .Cells(i, "S")
                    .Cells(i, "AW").Interior.Color = RGB(235 / 241 / 222)
                    .Cells(i, "AX") = .Cells(i, "T")
                    .Cells(i, "AX").Interior.Color = RGB(235 / 241 / 222)
                    .Cells(i, "AY") = .Cells(i, "U")
                    .Cells(i, "AY").Interior.Color = RGB(235 / 241 / 222)
                    .Cells(i, "AZ") = .Cells(i, "V")
                    .Cells(i, "AZ").Interior.Color = RGB(235 / 241 / 222)

                'Groupe 4
                ElseIf NB_FNC > 2 And PPM < 20000 And QSC > 0.85 Then

                    .Cells(i, "AP") = .Cells(i, "O")
                    .Cells(i, "AP").Interior.Color = RGB(255 / 255 / 0)
                    .Cells(i, "AQ") = .Cells(i, "S")
                    .Cells(i, "AQ").Interior.Color = RGB(255 / 255 / 0)
                    .Cells(i, "AR") = .Cells(i, "T")
                    .Cells(i, "AR").Interior.Color = RGB(255 / 255 / 0)
                    .Cells(i, "AS") = .Cells(i, "U")
                    .Cells(i, "AS").Interior.Color = RGB(255 / 255 / 0)
                    .Cells(i, "AT") = .Cells(i, "V")
                    .Cells(i, "AT").Interior.Color = RGB(255 / 255 / 0)

                'Groupe 3
                ElseIf NB_FNC > 2 And PPM < 20000 And QSC < 0.85 Then

                    .Cells(i, "AJ") = .Cells(i, "O")
                    .Cells(i, "AJ").Interior.Color = RGB(252 / 213 / 180)
                    .Cells(i, "AK") = .Cells(i, "S")
                    .Cells(i, "AK").Interior.Color = RGB(252 / 213 / 180)
                    .Cells(i, "AL") = .Cells(i, "T")
                    .Cells(i, "AL").Interior.Color = RGB(252 / 213 / 180)
                    .Cells(i, "AM") = .Cells(i, "U")
                    .Cells(i, "AM").Interior.Color = RGB(252 / 213 / 180)
                    .Cells(i, "AN") = .Cells(i, "V")
                    .Cells(i, "AN").Interior.Color = RGB(252 / 213 / 180)

                'Groupe 2
                ElseIf NB_FNC > 2 And PPM > 20000 And QSC > 0.85 Then

                    .Cells(i, "AD") = .Cells(i, "O")
                    .Cells(i, "AD").Interior.Color = RGB(250 / 191 / 143)
                    .Cells(i, "AE") = .Cells(i, "S")
                    .Cells(i, "AE").Interior.Color = RGB(250 / 191 / 143)
                    .Cells(i, "AF") = .Cells(i, "T")
                    .Cells(i, "AF").Interior.Color = RGB(250 / 191 / 143)
                    .Cells(i, "AG") = .Cells(i, "U")
                    .Cells(i, "AG").Interior.Color = RGB(250 / 191 / 143)
                    .Cells(i, "AH") = .Cells(i, "V")
                    .Cells(i, "AH").Interior.Color = RGB(250 / 191 / 143)

                'Groupe 1
                ElseIf NB_FNC > 2 And PPM > 20000 And QSC < 0.85 Then

                    .Cells(i, "X") = .Cells(i, "O")
                    .Cells(i, "X").Interior.Color = RGB(255 / 0 / 0)
                    .Cells(i, "Y") = .Cells(i, "S")
                    .Cells(i, "Y").Interior.Color = RGB(255 / 0 / 0)
                    .Cells(i, "Z") = .Cells(i, "T")
                    .Cells(i, "Z").Interior.Color = RGB(255 / 0 / 0)
                    .Cells(i, "AA") = .Cells(i, "U")
                    .Cells(i, "AA").Interior.Color = RGB(255 / 0 / 0)
                    .Cells(i, "AB") = .Cells(i, "V")
                    .Cells(i, "AB").Interior.Color = RGB(255 / 0 / 0)

                End If

        Next i

    End With

End Sub

Pour les plus téméraires. J'aimerais ensuite afficher ce classement des clients sur 3 colonnes dans la Feuil2, de la ligne 2 à la ligne 44 pour que ca tienne sur une seule page.

En espérant que vous pourrez me venir en aide,

Bonne journée,

Floo73

Pourquoi mets tu des slash pour tes rgb?

Rgb(255/1/1) tu ne donnes qu'un seul argument, le rouge. En effet tu fais deux divisions successives..

Il faut les remplacer par des virgules rgb(255,1,1)

Bonjour,

A tester...

Cdlt

'Groupe 8
            If NB_FNC = 1 And PPM < 20000 And QSC > 0.85 Then
                With .Range("BN" & i & ":BR" & i)
                    .Value = .Range("O" & i & ":V" & i)
                    .Interior.Color = RGB(0, 176, 80)
                End With

Bonjour à tous les 2,

Merci pour la fulgurance et la pertinence de vos réponses !

Tout marche du tonnerre !

Bonne journée et bonnes vacances à vous,

Floo73

Rechercher des sujets similaires à "argument facultatif"