For i=12 to 35 mais pas 30 ?

benoua

XLDnaute Occasionnel
Bonjour à tous

Code:
For agregat = 17 To 35
     If (line.Columns(agregat) <> 0) Then
    
       target.Cells(indexRow, "A").Value = CodeUR
       target.Cells(indexRow, "B").Value = affaire
       target.Cells(indexRow, "C").Value = localisation
       target.Cells(indexRow, "D").Value = intitule
             
       If (source.Cells(4, agregat) = "Salaires CDI") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Salaires CDD") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
        ElseIf (source.Cells(4, agregat) = "Salaires Autres") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Frais d'Expatriation") Then
         target.Cells(indexRow, "E").Value = "2"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Missions") Then
         target.Cells(indexRow, "E").Value = "3"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Fonctionnement") Then
         target.Cells(indexRow, "E").Value = "6"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Co-Traitance") Then
         target.Cells(indexRow, "E").Value = "7"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Autres Charges") Then
         target.Cells(indexRow, "E").Value = "9"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Equipement Propriété Client") Then
         target.Cells(indexRow, "E").Value = "4"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Equipement Propriété Cirad") Then
         target.Cells(indexRow, "E").Value = "5"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Sous-Traitance Interne (inter)") Then
         target.Cells(indexRow, "E").Value = "8"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Sous-Traitance Interne (intra)") Then
         target.Cells(indexRow, "E").Value = "16"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Produits Externes") Then
         target.Cells(indexRow, "E").Value = "10"
         coefficient = 1
       ElseIf (source.Cells(4, agregat) = "Produits Internes (inter)") Then
         target.Cells(indexRow, "E").Value = "11"
         coefficient = 1
        ElseIf (source.Cells(4, agregat) = "Produits Internes (intra)") Then
         target.Cells(indexRow, "E").Value = "17"
         coefficient = 1
         ElseIf (source.Cells(4, agregat) = "Autres Produits") Then
         target.Cells(indexRow, "E").Value = "14"
         coefficient = 1
       Else
         target.Cells(indexRow, "E").Value = source.Cells(1, agregat)
         coefficient = 1
       End If
      
      
       target.Cells(indexRow, "F") = line.Columns(agregat).Value / 1000 * coefficient
       
       indexRow = indexRow + 1

Dans le code suivant j'aimerai qu'il ne prenne pas la colonne 30 en compte, est ce que vous pouvez m'aider plz, je ne trouve pas le code qu'il faut mettre... :/
 

benoua

XLDnaute Occasionnel
Re : For i=12 to 35 mais pas 30 ?

Impeccable ca fonctionne! C'est tout bête mais je n'y avais pas pensé! :eek:
merci beaucoup

edit : ta solution fonctionne aussi Chti160! Merci
et je me rends compte que je dois rentrer chez moi.. j'susi vraiment fatigué pour ne pas avoir pensé à mettre ça au lieu de me prendre la tête sur le For :-/
 
Dernière édition:

Statistiques des forums

Discussions
312 472
Messages
2 088 710
Membres
103 930
dernier inscrit
Jibo